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
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