c++ - What will happen if I keep incrementing an iterator? -


I have a simple question: What if I continue to extend the interferral Iterator () the last one) + STL container? E.g.

  set & lt; Int & gt; intSet; IntSet.insert (0); IntSet.insert (1); IntSet.insert (2); Set & lt; Int & gt; :: Iterator Setter = intSet.begin (); For (Int i = 0; I & lt; 10; i ++) Set Ether ++;   

So, will be set intSet.end () always? Or is it an undefined behavior (can I give incompatible junk)?

The only work to grow is nothing , at least the GNU compilers .

If you try dereference, it invites undefined behavior.

For more discussion, see.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -