hash_multiset::upper_bound
[!참고]
이 API는 사용되지 않습니다.대신 unordered_multiset Class.
지정한 키 보다 큰 키를 가진은 hash_multiset의 첫 번째 요소에 반복기를 반환 합니다.
const_iterator upper_bound(
const Key& _Key
) const;
iterator upper_bound(
const Key& _Key
);
매개 변수
- _Key
요소를 검색 하 고 hash_multiset에서 정렬 키를 비교할 인수 키.
반환 값
반복기 또는 const_iterator 인수 키 보다 큰 키를 가진 첫 번째 요소에는 hash_multiset의 위치 주소 또는 키에 일치 항목이 없을 경우 마지막 요소에는 hash_multiset 이후 위치를 해결 합니다.
설명
Visual C++.NET 2003 멤버는 <hash_map> 및 <hash_set> 헤더 파일이 더 이상 std 네임 스페이스에 있지만 오히려 stdext 네임 스페이스로 이동 되었습니다.자세한 내용은 stdext 네임스페이스를 참조하십시오.
예제
// hash_multiset_upper_bound.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multiset <int> hms1;
hash_multiset <int> :: const_iterator hms1_AcIter, hms1_RcIter;
hms1.insert( 10 );
hms1.insert( 20 );
hms1.insert( 30 );
hms1_RcIter = hms1.upper_bound( 20 );
cout << "The first element of hash_multiset hms1" << endl
<< " with a key greater than 20 is: "
<< *hms1_RcIter << "." << endl;
hms1_RcIter = hms1.upper_bound( 30 );
// If no match is found for the key, end( ) is returned
if ( hms1_RcIter == hms1.end( ) )
cout << "The hash_multiset hms1 doesn't have an element "
<< "\n with a key greater than 30." << endl;
else
cout << "The element of hash_multiset hms1"
<< "with a key > 40 is: "
<< *hms1_RcIter << "." << endl;
// An element at a specific location in the hash_multiset can be
// found by using a dereferenced iterator addressing the location
hms1_AcIter = hms1.begin( );
hms1_RcIter = hms1.upper_bound( *hms1_AcIter );
cout << "The first element of hms1\n with a key greater than "
<< endl << "that of the initial element of hms1 is: "
<< *hms1_RcIter << "." << endl;
}
요구 사항
헤더: <hash_set>
네임 스페이스: stdext