A
Amit Bhatia
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>::iterator 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<A> mylist;
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.
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>::iterator 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<A> mylist;
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.