map用法

#include<bits/stdc++.h>
using namespace std;
struct node{
    int x,y;
    bool operator <(const node &temp)const{
        if(x<temp.x)return true;
        return false;
    }
};
int main()
{
    map<node,int>Map;
    node temp;
    temp.x=1,temp.y=1;
    Map[temp]=1;
    cout<<Map[temp]<<endl;
    temp.x=2;
    cout<<Map[temp]<<endl;
    return 0;
    输出:1
        :0
}

  

原文地址:https://www.cnblogs.com/lengsong/p/11287203.html