• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <flat_set>

    std::flat_multiset::size

    size_type size() const noexcept;
    

    概要

    コンテナ内の要素の数を返す。

    戻り値

    flat_multiset クラスが内部で保持している container_typec とすると、以下を返す。

    return c.size();
    

    計算量

    定数時間。

    #include <flat_set>
    #include <iostream>
    
    int main ()
    {
      std::flat_multiset<int> fs;
    
      std::cout << fs.size() << std::endl;
    
      fs.insert(1);
      fs.insert(2);
      fs.insert(3);
      fs.insert(1);
    
      std::cout << fs.size() << std::endl;
    }
    

    出力

    0
    4
    

    バージョン

    言語

    • C++23

    処理系

    関連項目