This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How set an iterator to NULL


Since last week this small program does no longer compile.
My question are:
Is this correct or should I file a bug report?
How is it possible to initialize an iterator to NULL?

Michael Cieslinski



<example.cpp>


#include <list>

struct S { int x; };

std::list<S>::iterator IT;

void Init()
{
    IT = NULL;
}



g++ -c example.cpp
example.cpp: In function 'void Init()':
example.cpp:9: error: no match for 'operator=' in 'IT = 0l'
stl_list.h:112: note: candidates are: std::_List_iterator<S>&
std::_List_iterator<S>::operator=(const std::_List_iterator<S>&)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]