• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <flat_map>

    std::flat_multimap::cbegin

    const_iterator cbegin() const noexcept;
    

    概要

    コンテナの先頭のキーと要素のpairを参照するイテレータを取得する。

    内部的に、このコンテナは要素を下位から上位へと並べており、従って cbegin() はコンテナ内の最下位のキーにあたるpairへのイテレータを返す。

    戻り値

    コンテナの先頭要素へのイテレータ。 const_iterator はメンバ型である。このクラステンプレートにおいて、この型はランダムアクセスイテレータである。

    計算量

    定数時間。

    #include <flat_map>
    #include <iostream>
    
    int main()
    {
      std::flat_multimap<int, char> fm = {
        {10, 'A'}, {11, 'B'}, {12, 'C'},
        {10, 'a'}, {11, 'b'}, {12, 'c'},
      };
    
      for (auto i = fm.cbegin(); i != fm.cend(); ++i) {
          std::cout << i->first << " " << i->second << "\n";
      }
    }
    

    出力

    10 A
    10 a
    11 B
    11 b
    12 C
    12 c
    

    処理系

    関連項目

    名前 説明
    flat_multimap::begin 先頭を指すイテレータを取得する
    flat_multimap::end 末尾の次を指すイテレータを取得する
    flat_multimap::cend 末尾の次を指すconstイテレータを取得する
    flat_multimap::rbegin 末尾を指す逆イテレータを取得する
    flat_multimap::rend 先頭の前を指す逆イテレータを取得する
    flat_multimap::crbegin 末尾を指す逆constイテレータを取得する
    flat_multimap::crend 先頭の前を指す逆constイテレータを取得する