I have the following two lines in the header to declare a vector containing a pattern:
template <class t> std::vector <t> vec;
However, I get the following error: the 'vec' data item cannot be a member template. What did I do wrong? Edit: I donβt know that they understood me correctly, Iβm trying to declare a vector containing a template, I know that this can be done, because you can have the following:
template <class T> void funct(vector <T> v){ }
this function takes the template vector as a parameter, I want to do the same thing except declare the vector in the header so that the vector can contain anything.
c ++ vector templates
user2673108
source share