about iterators' cross boundary

H

hpsoar

have the containers in stl taken measures to prevent or check
iterators' cross boundary? or they just let the users to do the
things?
 
J

James Kanze

It's mostly implementation-defined.

Technically, if you violate the contract, your code has
undefined behavior. Most good implementations have defined it,
however.
Standard vector::iterators, for example, are usually just
pointers; in the debug version of STLPort, though, they're of
a runtime-checked class type.

Is there any modern version of the STL in which any of the
iterators are just pointers. It's not the case with g++; I'll
admit that I've not looked at the sources elsewhere, but since
VC++ (Dinkumware) also traps most of the possible runtime
errors, I don't think that they use raw pointers either.
 

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

Similar Threads

sorts and iterators 10
Subtyping iterators 5
typetraits of STL containers and iterators 6
iterators 4
Minimum Total Difficulty 0
What do you think about this script? 0
set of iterators 5
iterators 0

Members online

No members online now.

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,431
Latest member
ElyseG3173

Latest Threads

Top