vector behaviour
-
Hi All, Can anyone tell me if a vector automatically sorts all its string entries in alphabetical order? Thanks and Regards, Anil
No it doesn't. You can sort it manually like this:
sort(vec.begin(), vec.end());
Or you could use a
set
ormultiset
. Steve -
Hi All, Can anyone tell me if a vector automatically sorts all its string entries in alphabetical order? Thanks and Regards, Anil
Anil_vvs wrote:
Can anyone tell me if a vector automatically sorts all its string entries in alphabetical order?
Try
std::set
instead ofstd::vector
-
Anil_vvs wrote:
Can anyone tell me if a vector automatically sorts all its string entries in alphabetical order?
Try
std::set
instead ofstd::vector
std::set
holds unique values. usestd::multiset
to emulate a sorted vector more closely.. Regards :rose: Angel :rose: ********************************************* The sooner you fall behind, the longer you have to catch up.