大概学了一下重载运算符的方法···鉴于我的记性实在是呵呵呵呵···写个test···顺便记一下初始化表的写法TUT
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<limits.h>
#include<time.h>
#include<stdlib.h>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#define LL long long
using namespace std;
struct node
{
int a;
node(int a) : a(a) {}
node() {}
node operator + (const node& tmp) const
{
return node(a + tmp.a);
}
bool operator < (const node& tmp) const
{
return a < tmp.a;
}
} node1, node2;
int main()
{
node1.a = 1, node2.a = 2;
printf("node1 + node2 = %d\n", (node1 + node2).a);
if(node1 < node2)
printf("node1 < node2\n");
else
printf("node1 >= node2\n");
return 0;
}