hash_multimap::const_reference
참고
이 API는 사용되지 않습니다.unordered_multimap 클래스를 대신 사용하는 것이 좋습니다.
A type that provides a reference to a const element stored in a hash_multimap for reading and performing const operations.
typedef list<typename _Traits::value_type, typename _Traits::allocator_type>::const_reference const_reference;
설명
Visual C++.NET 2003에서, <hash_map> 및 <hash_set> 헤더 파일의 멤버는 더 이상 std 네임스페이스에 존재하지 않습니다. 대신 stdext 네임스페이스로 이동되었습니다. 자세한 내용은 stdext 네임스페이스를 참조하십시오.
예제
// hash_multimap_const_ref.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multimap<int, int> hm1;
typedef pair <int, int> Int_Pair;
hm1.insert ( Int_Pair ( 1, 10 ) );
hm1.insert ( Int_Pair ( 2, 20 ) );
// Declare and initialize a const_reference &Ref1
// to the key of the first element
const int &Ref1 = ( hm1.begin( ) -> first );
// The following line would cause an error because the
// non-const_reference cannot be used to access the key
// int &Ref1 = ( hm1.begin( ) -> first );
cout << "The key of first element in the hash_multimap is "
<< Ref1 << "." << endl;
// Declare and initialize a reference &Ref2
// to the data value of the first element
int &Ref2 = ( hm1.begin() -> second );
cout << "The data value of 1st element in the hash_multimap is "
<< Ref2 << "." << endl;
}
요구 사항
헤더: <hash_map>
네임스페이스: stdext