共用方式為


multimap::cbegin

Returns a const iterator addressing the first element in the multimap.

const_iterator cbegin( ) const;

Return Value

A const bidirectional iterator addressing the first element in the multimap Class or the location succeeding an empty multimap.

Remark

With the return value of cbegin, the elements in the multimap object cannot be modified.

Example

// 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;
   }
The first element of m1 is 0

Requirements

Header: <map>

Namespace: std

See Also

Reference

multimap Class

Standard Template Library

Other Resources

multimap Members