2025-11-30 14:20:40
Wishing C had the ability to do compile-time polymorphism.
Like, I have base class Foo with Bar/Baz derived from it.
I want to be able to put a method DoSomething() in Foo and call it on a Bar or Baz object in a template, without putting a vtable in Foo or incurring the overhead of a virtual method call.
You can sort of get this effect by having Bar/Baz be separate classes with no common base and make the template just call T.Foo() for parameter T, but this eliminates som…