I have this class (.h file):
class Entity { public: template<typename T, typename... Args> T& addComponent(Args &&... args) { // add component and return } }; When I get an specific type, i want a different behavior, so I'm triying to overload the "addComponent" method like this (.cpp file):
template<> TransformComponent& Entity::addComponent<TransformComponent>() { printf("overloaded! \n"); // add component and return } the method call is made like this:
entity.addComponent<TransformComponent>(); but the method is never called.
https://stackoverflow.com/questions/66523478/template-method-overload-not-called March 08, 2021 at 10:06AM
没有评论:
发表评论