I am trying to create a simple template class wherein I create an object of the template class providing a container as the template type , from my understanding of templates , this should be no problem and should be handled exactly like int or char, but it always gives me an error saying:
"template argument 1 is invalid"
Here is the line at which I encounter this error :
templateTest<(std::list<int>)> testingTheTemplate;
Here is a skeleton of the template class
template <class testType> class templateTest
{
/* use some iterators and print test data here */
};
What am I missing here?
You forgot the semicolon after the class definition:
Also, declare your instantiation as this:
No parenthesis and notice the space in between.
Before C++11,
<<and>>are treated as operators. You must separate them in cases like this.