Use C ++ reverse function

reverse function-is reverse (or reverse), used for strings, arrays, container. Header files are #include <algorithm>

reverse function for reversing the order of [first, last) (which include elements of the first point, last point does not include the elements), reverse function does not return a value

eg. 

STR String = "Hello World, Hi" ;
 Reverse (STR . the begin ( ) , STR . End ( ) ) ; // STR result ih, dlrow olleh
Vector <int > v = { . 5 , . 4 , . 3 , 2 , . 1 } ; Reverse (v . the begin ( ) , v . End ( ) ) ; value // container becomes 1,2,3,4,5 v
 

Guess you like

Origin www.cnblogs.com/yuanch2019/p/11591995.html