• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <flat_map>

    std::flat_multimap::empty

    [[nodiscard]] bool empty() const noexcept; // (1) C++23
    

    概要

    コンテナが空かどうかをテストする。 コンテナが空(size() が 0)の場合に true を返す。

    この関数はコンテナ内のコンテンツを変化させない。コンテンツをクリアするには clear() メンバ関数を使用する。

    戻り値

    コンテナサイズが 0 のときに true, そうでないときに false を返す。

    計算量

    定数時間。

    #include <flat_map>
    #include <iostream>
    
    int main ()
    {
      std::flat_multimap<int, char> fm;
    
      std::cout << fm.empty() << std::endl;
    
      fm.insert({42, 'a'});
    
      std::cout << fm.empty() << std::endl;
    }
    

    出力

    1
    0
    

    バージョン

    言語

    • C++23

    処理系