I want to move first element of vector to the end of vector.
v = {1,2,3,4} after this should be like this
v= {2,3,4,1}
my compiler version is gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
I know in Vc11 we can use std::move to move element. but how can I do this in above version of compiler?
There's a std::rotate algorithm in the standard library:
std::rotate(ObjectToRotate.begin(),
            ObjectToRotate.end()-1, // this will be the new first element
            ObjectToRotate.end());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With