#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
struct MyStruct
{
std::string a1;
std::string a2;
std::string a3;
bool operator <(const MyStruct& myStruct) const
{
if (a1 != myStruct.a1) return a1 < myStruct.a1;
if (a2 != myStruct.a2) return a2 < myStruct.a2;
return a3 < myStruct.a3;
}
bool operator==(const MyStruct& myStruct) const
{
return a1 == myStruct.a1 && a2 == myStruct.a2 && a3 == myStruct.a3;
}
};
int main()
{
std::vector<MyStruct> vt;
MyStruct my1;
my1.a1 = "baidu1.com";
my1.a2 = "001";
my1.a3 = "001";
vt.push_back(my1);
MyStruct my2;
my2.a1 = "baidu2.com";
my2.a2 = "001";
my2.a3 = "001";
vt.push_back(my2);
MyStruct my3;
my3.a1 = "baidu3.com";
my3.a2 = "001";
my3.a3 = "001";
vt.push_back(my3);
std::sort(vt.begin(), vt.end());
vt.erase(std::unique(vt.begin(), vt.end()), vt.end());
for (auto &v:vt)
{
std::cout << v.a1 << " " << v.a2 << " " << v.a3 << std::endl;
}
getchar();
}