How to remove duplicates from std :: vector <std :: pair <UnicodeString, UnicodeString >>

how to remove duplicate values ​​from

std::vector <std::pair<UnicodeString, UnicodeString> > myVect;

Is there a built-in function or do I need to write my own code for this

+3
source share
2 answers

, (a) a std::set , [ , std::vector, ) (b) std::vector [ ], ... Fred Nurk answer to ++, vector list less.

+6

, , :

   std::sort(myVect.begin(), myVect.end());
   myVect.erase(std::unique(myVect.begin(), myVect.end()), myVect.end());

, UnicodeString < .

, ​​ std:: set std:: unordered_set, .

+2

All Articles