std::experimental::erase (std::deque)
ja.cppreference.net より
< cpp | experimental
| ヘッダで定義 <experimental/deque>
|
||
template< class T, class A, class U >
void erase( std::deque<T, A>& c, const U& value );
|
(library fundamentals TS v2) | |
コンテナから value と等しいすべての要素を消去します。 と同等です c.erase(std::remove(c.begin(), c.end(), value), c.end());.
パラメータ
| c | - | 要素を削除するコンテナ |
| value | - | 削除する値 |
計算量
線形。
例
このコードを実行
#include <experimental/deque> #include <iostream> auto show = [](const auto& container) { for (auto e : container) std::cout << e; std::cout << '\n'; }; int main() { std::deque<int> data{1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1}; show(data); std::experimental::erase(data, 1); show(data); }
出力:
11141112111 42
関連項目
| 特定の条件を満たす要素を削除する (関数テンプレート & アルゴリズム関数オブジェクト) | |
(C++20)(C++20) |
|
(library fundamentals 2 TS) |
述語を満たすすべての要素をstd::deque から削除する(関数テンプレート) |