【问题标题】:C++ collections with built-in remove operations?具有内置删除操作的 C++ 集合?
【发布时间】: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.))

【问题讨论】:

标签: c++ stl


【解决方案1】:

http://en.cppreference.com/w/cpp/container 的底部,我看到一个表格列出了所有STL 容器上的所有操作,而remove/remove_if 只出现在forward_listlist 上。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-02
    • 1970-01-01
    • 1970-01-01
    • 2018-08-13
    • 2011-08-20
    • 1970-01-01
    相关资源
    最近更新 更多