Sorting part of a vector

Hello,

In a vector of integers, I would like to sort elements whose indices are between 24 and 42. This code

sort(myvector.begin()+24,myvector.begin()+42, custom_debug_comparator);

seems to compare only elements in range [0;18]. How to use the standard sort function in this case ?
Last edited on
That line should work, what's the code of custom_debug_comparator?
I got it ! First s/42/43/. The other point is that I expected my comparator to be given indices, instead of values. Thank you for replying.
Last edited on
Topic archived. No new replies allowed.