Why can't I use mid here?
Feb 27, 2019 at 8:04pm
Why do I get an error when computing the following line?
|
vector<int>::iterator mid = (vi.begin() + vi.end()) / 2;
|
Feb 27, 2019 at 8:18pm
What is the error?
Feb 27, 2019 at 8:20pm
You can't add the iterators.
Try
|
vector<int>::iterator mid = vi.begin() + vi.size() / 2;
|
Topic archived. No new replies allowed.