名前空間
変種
操作

std::experimental::erase (std::deque)

From cppreference.com
 
 
 
 
ヘッダ <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


[編集] 関連項目

特定の基準を満たす要素を削除する
(関数テンプレート) [編集]
(ライブラリの基本機能 2 TS)
std::deque から、述語を満たすすべての要素を削除します。
(関数テンプレート) [[編集]]
English 日本語 中文(简体) 中文(繁體)