二维结构体vector CE是咋回事?

学术版

xu_zhihao @ 2024-10-02 21:00:33

报错那行的代码

int xmn=x2[1].lower_bound(x2[1].begin(),x2[1].end(),1)-x2[1].begin()-1;

vectornode 的定义

struct node{
    int num;
    int id;
    bool operator<(const node &cmp)const{
        return num<cmp.num;
    }
    bool operator>(const node &cmp)const{
        return num>cmp.num;
    }
    bool operator==(const node &cmp)const{
        return num==cmp.num;
    }
};
vector<node>x1[N];
vector<node>y1[N];
vector<node>x2[N];
vector<node>y2[N];

报错信息

[Error] 'class std::vector<node>' has no member named 'lower_bound'

求条悬两关


by liangbowen @ 2024-10-02 21:01:58

直接

lower_bound(x2[1].begin(),x2[1].end(),1)-x2[1].begin()-1

即可


by xu_zhihao @ 2024-10-02 21:02:40

@liangbowen 谢谢wssb


by jason_sun @ 2024-10-02 21:03:01

看笑了


by xu_zhihao @ 2024-10-02 21:07:23

@jason_sun aaaa

打磨你写了150行加发烧39.2直接给我洪文了


|