missing template argument before “*” token
I have this line of code in two different classes, in similar positions:
In one case it works perfectly, in another case i get the error mentioned in the subject, is there a reason for this?
What does such error mean?
Actually what I need is only to split a string into a list on which I can iterate and do things, if you have other straightforward ways to do it feel free to suggest.
[EDIT: code formatting, Volker]
QList is a template class, (see http://www.cplusplus.com/doc/tutorial/templates/)
So you have to define which type of variables it works with ie. two variables of type QList<QString> or QList<int> are a list of qstrings and a list of integers you can’t have a pointer to list without knowing what kind of pointer, afaik.
I guess you observe the different behavior because QList* is a critical error and it never goes to the next point, although if only a line seperates them in a file my compiler would give both as an error.
for your problem I would use something like
Note that foreach is a qt specific language construct but is kinda like for(int i=0; i<10;++i) etc..
I see….well, actually I just need to create a list of lists, or vector of vectors, or array of arrays, or whatever. But it seems to be impossible in QT: if i use QLists, then they cannot contain QLists, but they can contain only other types, like qstrings or or int or other, and as I understand it, Qlists can only contain a type of objects at once.
I wonder if in QT it exists the possibility to create lists of multiple types of objects, included lists.
Or maybe it is possible to create multidimentional lists?
Or in other words, can containers contain containers?
Sure they can! QVector< int > is a type for instance:
are perfectly legal.
PS: After a second reading of your question, a container in general cannot contain multiple types (i.e. you cannot mix doubles and int), however using polymorphism you can do it, by storing pointers. But I’m not sure this was your question.