class Base {
public:
    template<typename T>
    static Base* construct() {
        return new Derived<T>();
    }
};
template<typename T>
class Derived : public Base {
public:
    Derived() {}
};
That code generates a compile error (VS Studio 2017):
syntax error: unexpected token 'identifier', expected 'type specifier'
Is this invalid C++? Is this pattern not possible?
 
     
     
     
    