[Qt-interest] QList<T*>::iterator

Norbert Bokor bokorn at tvn.hu
Fri May 15 10:53:16 CEST 2009


Hi guys,

I have a template class which has a QList<T*> variable. I want to use an 
iterator for this list, but it doesn't work, the compiler says:

In file included from 
src/test.cpp:7:                                                                                                

src/propertylist.h: In member function 
'PropertyList<T>::push(T*)':                                                  

src/propertylist.h:130: error: expected `;' before 
'p_before'                                                                        

src/propertylist.h:132: error: 'p_before' was not declared in this 
scope          


that part of the code:

template <class T>
bool PropertyList<T>::push(T *item)
{
    QList<T * >::iterator p_before;   // this is line 130

What's wrong with this? If i write QList<int>::iterator for example, the 
compiler accepts it.

Thanks in advance for advices.

regards,

bokorn

PS: QT 4.5.1, gcc 4.3.3






More information about the Qt-interest-old mailing list