• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <flat_map>

    std::flat_multimap::keys

    const key_container_type& keys() const noexcept; // C++23
    

    概要

    キーのコンテナを取得する。

    戻り値

    flat_multimap クラス内部で保持しているキーのコンテナ。

    計算量

    定数時間

    #include <flat_map>
    #include <iostream>
    #include <type_traits>
    #include <vector>
    
    int main()
    {
      std::flat_multimap<int, char> fm;
      fm.insert({3, 'C'});
      fm.insert({1, 'A'});
      fm.insert({2, 'B'});
      fm.insert({1, 'a'});
    
      static_assert(std::is_same_v<decltype(fm.keys()), const std::vector<int>&>);
    
      for (auto i : fm.keys()) {
          std::cout << i << std::endl;
      }
    }
    

    出力

    1
    1
    2
    3
    

    バージョン

    言語

    • C++23

    処理系

    関連項目

    名前 説明
    flat_multimap::values 値のコンテナを取得する