6 ms·
In C++ you do it the other way around, have a single class that is polymorphic over templates. The name of this technique within C++ is type-erasure (that term
by Maxatar 9mo ago
In C++ you do it the other way around, have a single class that is polymorphic over templates. The name of this technique within C++ is type-erasure (that term means something else outside of C++).
Examples of type erasure in C++ are classes like std::function and std::any, and normally you need to implement the type erasure manually, but there are some library that can automate it to a degree, such as [1], but it's fairly clumsy.
[1] https://www.boost.org/doc/libs/latest/doc/html/boost_typeerasure.html https://www.boost.org/doc/libs/latest/doc/html/boost_typeera...
- bfrog 9mo agoIt's neat this is a thing I guess, but I agree it looks fairly clumsy compared to the Rust answer.