包括:
重载运算符(输出、加减)
去重unique
利用sstream进行 转换
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<cstring>
#include<set>
#include<cmath>
#include<queue>
#include<sstream>
#include<algorithm>
#define rep(i,j,k) for(int i=j;i<k;++i)
#define mst(a,b) memset((a),(b),sizeof(a))
#include<cstring>
#define fi first
#define se second
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(ALL(v))
#define vunique(v) unique(ALL(v))
#define mp(a,b) make_pair(a,b)
using namespace std;
typedef long long LL;
typedef vector<int,int> vii;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
pll operator+(pll a, pll b) {return pll(a.fi+b.fi,a.se+b.se);}
pll operator-(pll a, pll b) {return pll(a.fi-b.fi,a.se-b.se);}
ostream &operator<<(ostream & out, pll a){out << a.fi << " " << a.se;}
string int2str(LL a){ostringstream os;os.str(""); os << a; return os.str();} // 转换前 清空流
LL str2int(string a){LL n;stringstream ss; ss.clear();ss << a; ss >> n; return n;}
int main()
{
/*
去重方法
*/
int a[] = {10,20,20,20,30,30,20,20,10};
vector<int> vec(a,a+9);
SORT(vec);
std::vector<int>::iterator it = vunique(vec);
vec.resize(std::distance(vec.begin(),it));
cout << std::distance(vec.begin(),it) <<endl;
rep(i,0,vec.size()){
cout << vec[i] << " ";
}
cout << endl;
/*
重载运算符
*/
pll c = mp(1,2);
pll d = mp(3,4);
pll e = c+d;
cout << e << endl;
/*
利用 stringstream 进行 int 与 string 转换 需要 头文件 sstream
*/
LL n = str2int("123456789");
string str = int2str(12313134131);
cout << n << endl;
cout << str << endl;
return 0;
}