小编byq*_*qqu的帖子

从迭代器获取对象

我想从中获取对象,set<Node>但我认为我的函数给了我这个对象的副本.怎么解决?

Node findByNum(int n){
    for (set<Node>::iterator it = this->children.begin();it != this->children.end(); it++){
        if ((*it).num == n){
            return (*it);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c++ function set

1
推荐指数
1
解决办法
690
查看次数

标签 统计

c++ ×1

function ×1

set ×1