struct node{
int data;
string str;
char x;
//自己写的初始化函数
void init(int a, string b, char c){
this->data = a;
this->str = b;
this->x = c;
}
node() :x(), str(), data(){}
node(int a, string b, char c) :x(c), str(b), data(a){}
};
//1.this写法
struct point
{
int elem;
bool operator==(const point b) const
{
return this->elem == b.elem;
}
bool operator!=(const point b) const
{
return this->elem != b.elem;
}
bool operator<=(const point b) const
{
return this->elem <= b.elem;
}
bool operator<(const point b) const
{
return this->elem < b.elem;
}
bool operator>=(const point b) const
{
return this->elem >= b.elem;
}
bool operator>(const point b) const
{
return this->elem > b.elem;
}
};
//2.&写法
struct node{
int dis,pos;
bool operator <(const node &x)const{
return x.dis<dis;
}
};
struct node{
int dis,pos;
bool operator <(const node &x)const{
return x.dis<dis;
}
bool
node(int d,int x){
dis=d;pos=x;
}
};