C++ si constexpr vs especialización de plantillas
Considere estos 2 ejemplos Ejemplo 1 template<Type type> static BaseSomething* createSomething(); template<> BaseSomething* createSomething<Type::Something1>() { return Something1Creator.create(); } template<> BaseSomething* createSomething<Type::Something2>() { return Something2Creator.create(); } …. // otros somethings Ejemplo 2 template<Type type> static BaseSomething* createSomething() { if constexpr(type == Type::Something1) { return Something1Creator.create(); } else if constexpr(type == Type::Something2) . . . Read more