std::erase, std::erase_if (std::basic_string)
来自cppreference.com
< cpp | string | basic string
| 定义于头文件 <string>
|
||
| template< ..., class U > void erase(std::basic_string<...>& c, const U& value); |
(1) | (C++20 起) |
| template< ..., class Pred > void erase_if(std::basic_string<...>& c, Pred pred); |
(2) | (C++20 起) |
1) 从容器中擦除所有比较等于
value 的元素。等价于 c.erase(std::remove(c.begin(), c.end(), value), c.end()); 。目录 |
[编辑] 参数
| c | - | 要从中擦除的容器 |
| value | - | 要擦除的值 |
| pred | - | 若应该擦除元素则返回 true 的一元谓词。 对每个(可为 const 的) |
[编辑] 复杂度
线性。
[编辑] 示例
| 本节未完成 原因:暂无示例 |
[编辑] 参阅
| 移除满足特定判别标准的元素 (函数模板) |