Re: looking for std::list::iterator NULL value
- From: "Victor Bazarov" <v.Abazarov@xxxxxxxxxxxx>
- Date: Mon, 8 Jan 2007 16:41:50 -0500
Ben Voigt wrote:
"Igor Tandetnik" <itandetnik@xxxxxxxx> wrote in message
news:OxnZ3g2MHHA.780@xxxxxxxxxxxxxxxxxxxxxxx
Ben Voigt <rbv@xxxxxxxxxxxxx> wrote:
I need an iterator value representing "not set" or "unassigned".
With a pointer into an array or linked list, I would just use the
value NULL. Is this possible with the standard library iterators?
A common choice for a special value iterator is container.end()
Can container.end() ever become a viable iterator, for example if
more items are added to a vector? Am I safe with a list?
You're fine. No list iterators are changed by insertions (and 'end'
is not changed by removals), so you can retain the value. However,
with other containers you're better off calling 'end' member every
time.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
- Follow-Ups:
- Re: looking for std::list::iterator NULL value
- From: Ben Voigt
- Re: looking for std::list::iterator NULL value
- References:
- looking for std::list::iterator NULL value
- From: Ben Voigt
- Re: looking for std::list::iterator NULL value
- From: Igor Tandetnik
- Re: looking for std::list::iterator NULL value
- From: Ben Voigt
- looking for std::list::iterator NULL value
- Prev by Date: Re: looking for std::list::iterator NULL value
- Next by Date: Re: looking for std::list::iterator NULL value
- Previous by thread: Re: looking for std::list::iterator NULL value
- Next by thread: Re: looking for std::list::iterator NULL value
- Index(es):
Relevant Pages
|