Dynamically register constructor methods in an AbstractFactory at compile time using C++ templates
Answer One The general technique of deriving a class like this is the Curiously Recurring Template Pattern (CRTP): class PingMessage: public MessageTmpl < 10, PingMessage > Your specific technique of using a template class’s static member initialization to register subclasses of that class is (IMO) simply brilliant, and I’ve never seen that before. A more … Read more