Is it possible to use template within a template, a list can be a list of anythings and a string can be a string of anythings, so can I have a list of strings of some other type, for example int?
The first thing that came to mind:
std::list<std::vector<int>> listOfVectorsOfIntegers;
Sadly, it failed, so I wonder, is there a way to legally do this?
Edit: Sorry, I wasn’t actually using string in my case, just typed it for a random container without considering it is not a template. In my case the problem was using >> instead of > >, adding an empty space fixes it.
std::stringis not a class template itselfYou probably want one of these:
In C++03, and C++98, the
>>should be separated by space; in C++11, there is no such need.