What happens if we use vector iterator in this manner to get the mid element of a vector?

A question from C++ Primer.

to get the mid element of a vector:
vector<int>::iterator mid = (vi.begin()+vi.end())/2;

or

vector<int>::iterator mid = vi.begin()+vi.size()/2;
 
Back
Top