#include<iostream>
#include<string>
#include<sstream>
#include<tuple>
#include<mutex>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
struct OutPutItem {
string match_vid;
bool scmp(OutPutItem &l, OutPutItem &r) {
return l.match_vid >= r.match_vid;
}
};
int main(void)
{
vector<OutPutItem> vct_output{ {"a"},{"b"},{"c"},{"a"},{"b"},{"c"} };
//删除重复的元素
sort(vct_output.begin(), vct_output.end(),[](OutPutItem &l, OutPutItem &r) {
return l.match_vid < r.match_vid;
});
vector<OutPutItem>::iterator vector_iterator;
vector_iterator = unique(vct_output.begin(), vct_output.end(), [](const OutPutItem &l, const OutPutItem &r) -> bool { return (l.match_vid == r.match_vid); });
if (vector_iterator != vct_output.end())
{
vct_output.erase(vector_iterator, vct_output.end());
}
for (auto i : vct_output) {
cout << i.match_vid << endl;
}
getchar();
return 0;
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询