I'm new to c++ and Im learning to use templates . I want to make a template class with 2 template parameters,and to specialize a single member function from the class, for the case where the second template parameter is a vector templated on a pointer type of the first parameter. I think an example of what I tried will be more clear :
//Container.h:
template<class T , class CONT >
class Container {
private:
CONT container;
T someData;
public:
void foo();
};
and the specilization for std::vector I tried is:
//Container.cpp
template<class T>
void Container<T, std::vector<T*> > ::foo(){
cout << "specialized foo: " << container.pop_back();
}
template<class T, class CONT >
void Container<T, CONT > ::foo(){
cout << "regular foo: " << container.pop_back());
}
but I get these erors:
error C3860: template argument list following class template name must list parameters in the order used in template parameter list
error C2976: 'Container<T,CONT>' : too few template argument
the usage of the Container class has to be that the 1st parameter is some type , and second is an STL container, vector or list. for example :
Container<int, vector<int*> > c;
c.foo();
what am I dong wrong ?