How set an iterator to NULL

chris jefferson caj@cs.york.ac.uk
Tue Sep 20 14:07:00 GMT 2005


Michael Cieslinski wrote:

>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?
>
>  
>
A patch was recently submitted specifically to stop this working, as it
shouldn't.

there isn't a general way of setting iterators to NULL (some people
believe there should be). The usual things to say are either a) don't
create the iterators until you have somewhere to point them, or b) often
(but not always) it is natural to use the iterator returned by
list.end() as a "NULL" iterator.

Chris



More information about the Gcc mailing list