【发布时间】:2017-02-15 20:46:44
【问题描述】:
哪些标准 C++ 集合包含内置 remove/remove_if 操作?
例如,我看到list 有它们:
http://www.cplusplus.com/reference/list/list/remove/ http://www.cplusplus.com/reference/list/list/remove_if/
list<int> mylist (...);
mylist.remove(42);
但vector 没有,我必须这样做v.erase(remove(etc.etc.etc.))
【问题讨论】:
-
您总是可以为每个容器look at the docs。我要问....你为什么还没有这样做?
-
search of the docs 报告的容器类型很可能会很好地指示哪些容器有这个,哪些没有。如果您search on
remove_if,那么该列表将相当剔除。 -
@Jay Bazuzi 我也在“算法”中看到过,cplusplus.com/reference/algorithm/remove
-
我正在寻找一个规范列表,并进行了谷歌搜索,但没有找到。我可以自己阅读文档,但我不确定我是否会错过任何重要的、微妙的细节。