Question: The iterator keeps the reference to the elements inside the vector. As vector is created using the array internally, iterator keep the reference for that..

The iterator keeps the reference to the elements inside the vector. As vector is created using the array internally, iterator keep the reference for that.. Once You call these functions, they can change the size of the vector either increase or decrease that, due to which, vector may need to reallocate a bigger or smaller array and move the original data there.. Once it reallocates array, the reference kept in iterators become invalid.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!