-3
我有一個向量textCommands
它保存結構稱爲TextCommand
包含RECT
和一個字符串;並且RECT
具有全部在屏幕座標中的值top
,left
,bottom
和right
。我想知道如何分類這個向量,然後我可以調用std::unique
並刪除重複條目。重複條目是具有相同字符串的條目,以及相同的所有值都相同的RECT
。排序屏幕座標
//Location in screen coordinates(pixels)
struct RECT
{
int top;
int left;
int bottom;
int right;
};
//text at location RECT
struct TextCommand
{
std::string text;
RECT pos;
};
std::vector<TextCommand> textCommands;
你說什麼?使用'std :: sort'。 –
@ CaptainObvious你打敗了我。 http://en.cppreference.com/w/cpp/algorithm/sort – Ceros
@CaptainObvlious我可以排序哪個參數? – Bcmonks