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
Post a Comment