3 Comments

simple, though powerful, useful and important

Expand full comment

I've been looking for a way to do this at compile time using templates but haven't found a solution. Is such a thing possible?

Expand full comment

With templates you don't get a common type.

Typically that means that at some point you will need some form of type erasure to stop the propagation of the templates.

If your goal is to get rid of the virtual methods, it is achievable: https://www.linkedin.com/posts/simontoth_cpp-coding-learnprogramming-activity-6987457184334807040-eBZK (my old post on void* type erasure).

Expand full comment