I have a vector of object pointers, and now I want to sort them according to their char keys. To be more specific, I want to sort the char keys (char c) in "lexicographical order".
For example, suppose I have a vector of objects of POINTERS<o1, o2, o3, o4, o5>
, and:
o1->c = 'd'
; o2->c = 'k'
; o3->c = 'x'
; o4->c = 'a'
; o5->c = 'j'
then after sorting, the vector should be:
<o4, o1, o5, o2, o3>
How do I do that? Thank you.