Iterator questions...

B

barcaroller

I've noticed that neither container.begin() nor container.end() return an
error when the container is empty, so I get a nasty segfault when I
dereference the iterator. Do I have to check if the container is empty
every time I use an iterator, or am I missing something?

Speaking of iterators: if I initialize 'iter = container.end()', can I count
on iter to stay equal to container.end() no matter what elements are deleted
or added to the container?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top