list演算子

提供:cppreference.com
移動: 案内, 検索


文法:

    #include <list>
    list& operator=(const list& c2);
    bool operator==(const list& c1, const list& c2);
    bool operator!=(const list& c1, const list& c2);
    bool operator<(const list& c1, const list& c2);
    bool operator>(const list& c1, const list& c2);
    bool operator<=(const list& c1, const list& c2);
    bool operator>=(const list& c1, const list& c2);

すべてのC++のコンテナは、標準の比較演算子(==, !=, %%<=%%, >=, <, >, %%=%%)を利用して、比較や代入を行うことができます。比較や代入には、 線形時間がかかります。

二つのリストは、以下の条件を満たすときに同じとみなされます:

  1. 二つのリストのサイズが同じ
  2. 一方のリストの位置iにある要素はすべて、もう一方のリストの位置iにある要素と同じ。

リストの比較は辞書順のような比較が行われます。

関連トピック: merge, unique

個人用ツール
名前空間
変種
操作
案内
ツールボックス
他の言語