std::experimental::erase (std::list)
來自 cppreference.com
定義於標頭檔案 <experimental/list> |
||
template< class T, class A, class U > void erase( std::list<T, A>& c, const U& value ); |
(庫基礎 TS v2) | |
從容器中擦除所有與 value 相等的元素。等價於 c.remove_if([&](auto& elem) { return elem == value; });。
目錄 |
[編輯] 引數
c | - | 要從中刪除元素的容器 |
value | - | 要刪除的值 |
[編輯] 複雜度
線性。
[編輯] 示例
執行此程式碼
輸出
11141112111 42
注意
與 std::list::remove 不同,此函式模板接受異構型別,在呼叫 == 運算子前不強制轉換為容器的值型別。
[編輯] 另請參閱
移除滿足特定標準的元素 (函式模板) | |
移除滿足特定標準的元素 ( std::list<T,Allocator> 的公開成員函式) | |
(庫基礎 2 TS) |
從 std::list 中擦除所有滿足謂詞的元素 (函式模板) |