os_rotate |
Rotates a sequence by n positions.
A helper algorithm for rotate()
. If n is positive, rotates the container to the right
by n positions; otherwise, rotates the container c to
the left by n positions.
#include <ospace/helper/helpalgo.h>
template< class Container >
void os_rotate( Container& c, int n )
#include <iostream>
#include <vector>
#include <ospace/helper.h>
int numbers[ 6 ] = { 0, 1, 2, 3, 4, 5 };
void
main()
{
vector< int > v( numbers, numbers + 6 );
os_rotate( v, 3 );
for ( vector< int >::iterator i = v.begin(); i != v.end(); ++i )
cout << *i << ` `;
cout << "\n";
}
3 4 5 0 1 2
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.