3 ms·
Yup,and this is excerbarated by the fact that c++ doesn't really offer any convenient equivalent of virtual methods with static dispatch. std::variant is almos
by strictfp 5y ago
Yup,and this is excerbarated by the fact that c++ doesn't really offer any convenient equivalent of virtual methods with static dispatch.
std::variant is almost it, but it's interface is quite horrendous as of now.
Another interesting thing is that c++ also intermingles dynamic allocation with polymorphism, which can lead to a lot of unnecessary pointer chasing
- dkersten 5y agoIf you're ok with third party libraries, there are some solutions to static polymorphism. For example, EnTT comes with this: https://github.com/skypjack/entt/wiki/Crash-Course:-poly https://github.com/skypjack/entt/wiki/Crash-Course:-poly
- strictfp 5y agoInteresting! As by pure chance, my current project already incorporates EnTT, so I will definitely give this a closer look. Thank you.