Hacker Newsnew | past | comments | ask | show | jobs | submit | dalvrosa's commentslogin

Yeah for C++17 or above, it's a nicer and more performant alternative in most cases



Thanks for the feedback, I'll consider expanding in a separate post

Good point, thanks for sharing!

Thank you :)

Nice one, TIL

One caveat with "hash vtables" is that you only really see a performance win when the interface has a lot of specializations.


As I just mentioned in another reply, the problem they were trying to solve was hierarchies where it makes sense for a group of types to be constructed by the combination of two or three narrowly scoped interfaces.

For instance, if you treat some collections as read only, you can define comprehensions across them with a single implementation. But that means the mutators have to be contained in another type, which a subset will implement, and may have covariant inputs.


Fair. New C++ standards are providing great tools for compile-time everything

But still CRTP is widely used in low-latency environments :)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: