Page 1 of 1

10 poll What are the iterator invalidation rules for insertion into std::vector and stilist? For vector: If a new array

Posted: Fri May 20, 2022 1:34 pm
by answerhappygod
10 Poll What Are The Iterator Invalidation Rules For Insertion Into Std Vector And Stilist For Vector If A New Array 1
10 Poll What Are The Iterator Invalidation Rules For Insertion Into Std Vector And Stilist For Vector If A New Array 1 (22.06 KiB) Viewed 20 times
10 poll What are the iterator invalidation rules for insertion into std::vector and stilist? For vector: If a new array is not allocated, then all the iterators at or after the point of insertion are invalid because of shifting the elements.If a new array is allocated, then all the iterators are invalid. For list:Iterators stay Valid. For vector: If a new array is not allocated, then all the iterators at or before the point of insertion are invalid because of shifting the elements. It a new array is allocated then all the iterators are invalid. For list:Iterators stay valid only if inserted at the front All the iterators become invalid for both vector and list For vector: Iterators become invalid only it a new array is allocated For list:Iterators stay valid All the iterators stay valid for both vector and list