• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <flat_set>

    std::flat_multiset::value_comp

    value_compare value_comp() const; // C++23
    

    概要

    コンテナに関連づけられた要素比較用の関数オブジェクトを返す。これはコンテナ内の二つの要素を比較するために利用できる。 これは同じ型の 2 つの引数をとり、狭義の弱順序に従って一つ目の引数が二つ目の引数の前になる場合に true、そうでない場合に false を返す。

    戻り値

    要素比較用の関数オブジェクト。 value_compare はメンバ型であり、key_compare と同じく、テンプレートパラメータ Compare の別名である。

    計算量

    定数時間。

    #include <flat_set>
    #include <iostream>
    
    int main()
    {
      std::flat_multiset<int> s;
      std::flat_multiset<int>::value_compare comp = s.value_comp();
    
      std::cout << comp(1, 2) << std::endl;
      std::cout << comp(3, 2) << std::endl;
    }
    

    出力

    1
    0
    

    バージョン

    言語

    • C++23

    処理系

    関連項目

    名前 説明
    key_comp キー比較用の関数オブジェクトを取得する