I have a bunch of strings that I need to sort. I think a std::vector would be the easiest way to do this. However, I\'ve never used vectors before and so would like some help.>
For sort use:
std::sort
or std::vector< std::string>::sort(..)
method.
To check if it is sorted:
use std::is_sorted
for check is sorted - http://www.sgi.com/tech/stl/is_sorted.html
or
std::adjacent_find( v.begin(), v.end(), std::greater< std::string >() ) == v.end()
for your case you could use default comparator
EDITED:
std::is_sorted
is not standard stl function, it defined in sgi stl implementation.
Thanks @Brian Neal for this note.