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