hash_map::cbegin
[!メモ]
この API は、互換性のために残されています。代わりに unordered_map クラスです。
hash_mapの最初の要素を指す定数反復子を返します。
const_iterator cbegin( ) const;
戻り値
空の hash_mapを成功させる hash_map Class の最初の要素または場所を指す定数の双方向反復子。
解説
cbegin の戻り値で hash_map オブジェクトを変更することはできません。
Visual C++ .NET 2003では、<hash_map> と <hash_set> ヘッダー ファイルのメンバーはstdの名前空間に存在しなくなりましたが、ではなくstdextの名前空間に型。詳細については、「The stdext Namespace」を参照してください。
使用例
// hash_map_cbegin.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_map <int, int> hm1;
hash_map <int, int> :: const_iterator hm1_cIter;
typedef pair <int, int> Int_Pair;
hm1.insert ( Int_Pair ( 2, 4 ) );
hm1_cIter = hm1.cbegin ( );
cout << "The first element of hm1 is "
<< hm1_cIter -> first << "." << endl;
}
必要条件
ヘッダー: <hash_map>
名前空間: のstdext