explicit instantiation of static var in class template

56 views Asked by At

I have the following class with a static data member but linking failed with undefined reference to X<int, int>::list

#include <vector>

template < typename T1, typename T2 >
class X
{
    public:
    static std::vector< X*> list;
};

template<>
std::vector< X<int,int>* > X<int,int>::list;


int main()
{
    X<int,int>::list.push_back( new X<int,int> );

}
0

There are 0 answers