我想替换集合中的一个元素。在谷歌搜索后,我遇到了这个函数replace
,但是当我使用它时,它给了我一个错误
no member named 'replace' in
更新或替换集合中元素的其他方法是什么?
最佳答案
您必须erase()
一个元素并insert()
新元素。 replace
没有为 std::set
定义。参见 http://www.cplusplus.com/reference/set/set/
关于c++ - 我如何替换集合中的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44213870/