4 ms·
C++ makes this possible via templates. Generally the size is moved to a template argument, which allows the compiler to check this at compile time (of course, t
by saagarjha 9y ago
C++ makes this possible via templates. Generally the size is moved to a template argument, which allows the compiler to check this at compile time (of course, this restricts you to statically sized matrices).
- joshuamorton 9y agoGood to know. I was apparently unaware how powerful templates were.
- zbentley 9y agoDon't feel too bad, almost everyone is. And almost all of the people who are aware of how "powerful" they are tend to equate "hellish complexity" with "expressive power" and are not people you want to work with. There are a few shining exceptions, but not many.
- laverick 9y agohttps://stackoverflow.com/a/22645853 https://stackoverflow.com/a/22645853
- joshuamorton 9y agoI think I knew that templates were Turing complete, but so are java generics, it's just that to get dependent types in generics you have to reinvent the integers within the generic system. Not so for templates, which I didn't realize. That's pretty nifty!