4 ms·
That's not polymorphism as that template parameter won't be deduced in any context and you will always have to explicitly instantiate the template.
by account42 2y ago
That's not polymorphism as that template parameter won't be deduced in any context and you will always have to explicitly instantiate the template.
- Maxatar 2y agoThat is still polymorphic, but as I mentioned C++ does not do the kind of type deduction that Haskell supports so you do have to explicitly instantiate the template. However, you can instantiate it based on context, for example using decltype.
- gpderetta 2y agochallenge accepted: https://gcc.godbolt.org/z/bGdP79aEj https://gcc.godbolt.org/z/bGdP79aEj edit: you get pseudo call-by-name as a bonus.