• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <flat_set>

    std::flat_multiset::operator=

    flat_multiset& operator=(initializer_list<value_type> il); // C++23
    

    概要

    初期化子リストの値を代入する。

    効果

    *thisの全ての要素が解放され、ilの全ての要素が*thisにコピー代入される。

    戻り値

    *this

    備考

    • 引数の型が const flat_multiset& であるコピー代入演算子と、引数の型が flat_multiset&& であるムーブ代入演算子は、それぞれ自動生成される。

    #include <flat_set>
    #include <iostream>
    #include <string>
    
    int main()
    {
      std::initializer_list<std::string> elems = {"Alice", "Bob", "Carol", "Alice"};
    
      std::flat_multiset<std::string> fs;
      fs = elems;
    
      for (const std::string& i : fs) {
        std::cout << i << std::endl;
      }
    }
    

    出力

    Alice
    Alice
    Bob
    Carol
    

    バージョン

    言語

    • C++23

    処理系