-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