User-Agent: OSXnews 2.081
Xref: number1.nntp.dc a.giganews.com comp.lang.c++:8 18044
Hi,
I am wondering if I can assign a list iterator = NULL. Suppose I have a
class A:
A.h
class A{
//ctors etc etc.
list<A>::iterat or it;
}
A.C
//;;
A::some_method
{
it = NULL; /??
}
Currently, I am using a pointer instead of an iterator(Hence above
operation is perfectly valid), but when I wish to delete this particular
object from another list
list<Amylist;
I will have to do a linear time operation. However, if I can use
iterator that can be set to NULL (or some other default identifiable location)
I can avoid this linear time deletionby using "erase" method of list template class.
Or is there some analogous thing to NULL for iterators?
thanks,
amit.