次の方法で共有


multimap::cbegin

map の最初の要素を指す定数反復子を返します。

const_iterator cbegin( ) const;

戻り値

空の multimapを成功させる multimap Class の最初の要素または場所を指す定数の双方向反復子。

解説

cbeginの戻り値を使用して、multimap のオブジェクト要素を変更できません。

使用例

// multimap_cbegin.cpp
// compile with: /EHsc
#include <map>
#include <iostream>

int main( )
{
   using namespace std;   
   multimap <int, int> m1;

   multimap <int, int> :: const_iterator m1_cIter;
   typedef pair <int, int> Int_Pair;

   m1.insert ( Int_Pair ( 0, 0 ) );
   m1.insert ( Int_Pair ( 1, 1 ) );
   m1.insert ( Int_Pair ( 2, 4 ) );

   m1_cIter = m1.cbegin ( );
   cout << "The first element of m1 is " << m1_cIter -> first << endl;
   }
  

必要条件

ヘッダー: <map>

名前空間: std

参照

関連項目

multimap Class

標準テンプレート ライブラリ