I would like to reverse a smaller range in a vector and haven't found any better solution than this: I extract the smaller range to a newly created vector, reverse it and then add the newly created vector at the former position in the original vector.
Another way to explain what I want to do is something like this:
Original vector: 1 2 3 4 5 6 7 8 9 10 11.
Wanted result: 1 2 3 4 5 6 7 10 9 8 11.
1. Copy 10, 9, 8 in that order into a new vector with three element or copy element 8, 9, 10 into a new vector an reverse it. The original vector consists now of nine elements because the elements 8, 9, 10 were erased in the procedure.
2.The new vector with the 3 elements 10, 9, 8 is then copied/appended into the original vector at position 8 as a vector or element by element at position 8, 9, 10 respectively.
I am sure there are better solutions then the method mentioned above.
All STL algorithms work on a range. Typically, begin/end are passed to process the whole container, but you don't have to pass the whole range all the the time irrespective of your needs.