다음을 통해 공유


hash_multiset 클래스

참고

이 API는 사용되지 않습니다.unordered_multiset 클래스를 대신 사용하는 것이 좋습니다.

The container class hash_multiset is an extension of the Standard Template Library and is used for the storage and fast retrieval of data from a collection in which the values of the elements contained serve as the key values and are not required to be unique.

template < 
   class Key,  
   class Traits=hash_compare<Key, less<Key> >,  
   class Allocator=allocator<Key>  
> 
class hash_multiset

매개 변수

  • Key
    The element data type to be stored in the hash_multiset.

  • Traits
    The type which includes two function objects, one of class compare that is a binary predicate able to compare two element values as sort keys to determine their relative order and a hash function that is a unary predicate mapping key values of the elements to unsigned integers of type size_t. This argument is optional, and the hash_compare*<Key,* less*<Key> >* is the default value.

  • Allocator
    The type that represents the stored allocator object that encapsulates details about the hash_multiset's allocation and deallocation of memory. This argument is optional, and the default value is allocator*<Key>.*

설명

The hash_multiset is:

  • 연관된 키 값을 기준으로 하며 요소 값의 효율적인 검색을 지원하는 가변 크기 컨테이너 결합형 컨테이너입니다. Further, it is a simple associative container because its element values are its key values.

  • 해당 요소에 액세스할 수 있는 양방향 반복기를 제공하기 때문에 되돌릴 수 있습니다.

  • 해쉬되었습니다. 해당 요소는 버킷으로 요소의 키 값에 적용되는 해쉬 함수의 값을 기준으로 그룹화되어 있습니다.

  • 각각의 요소가 반드시 고유한 키를 가지고 있어야 한다는 점에서 고유성을 갖고 있습니다. Because hash_multiset is also a simple associative container, its elements are also unique.

  • A template class because the functionality it provides is generic and so independent of the specific type of data contained as elements or keys. 요소에 사용될 데이터 형식과 키는 대신 비교 함수와 할당자와 함께 클래스 템플릿에서 매개 변수로 지정됩니다.

The main advantage of hashing over sorting is greater efficiency: a successful hashing performs insertions, deletions, and finds in constant average time as compared with a time proportional to the logarithm of the number of elements in the container for sorting techniques. The value of an element in a set may not be changed directly. Instead, you must delete old values and insert elements with new values.

컨테이너 형식의 선택은 응용 프로그램에 의해 검색과 삽입이 필요한 일반적인 형식에 기초해야 합니다. 해쉬된 연관된 컨테이너들은 조회, 삽입 및 제거 작업에 최적화되어 있습니다. 명시적으로 이러한 작업을 지원하는 멤버 함수는 평균적으로 컨테이너의 요소 갯수에 의존적이지 않고 상수 시간에 수행하는 잘 설계된 해쉬 함수와 함께 사용하면 효율적입니다. 잘 설계된 해쉬 함수는 해쉬 값을 균일한 분포시키며 다른 키 값에 동일한 해쉬 값이 매핑되는 경우 일어나는 충돌의 횟수를 최소화합니다. 가능한 최악의 해쉬 함수를 사용하며, 최악의 경우에 작업의 수는 시퀀스 내의 요소의 숫자에 비례합니다. (선형 시간)

The hash_multiset should be the associative container of choice when the conditions associating the values with their keys are satisfies by the application. The elements of a hash_multiset may be multiple and serve as their own sort keys, so keys are not unique. A model for this type of structure is an ordered list of, say, words in which the words may occur more than once. Had multiple occurrences of the words not been allowed, then a hash_set would have been the appropriate container structure. If unique definitions were attached as values to the list of unique keywords, then a hash_map would be an appropriate structure to contain this data. If instead the definitions were not unique, then a hash_multimap would be the container of choice.

The hash_multiset orders the sequence it controls by calling a stored hash traits object of type value_compare. 이 저장된 개체는 멤버 함수 key_comp를 호출하여 액세스할 수 있습니다. Such a function object must behave the same as an object of class hash_compare*<Key,* less*<Key> >.* Specifically, for all values Key of type Key, the call Trait(Key) yields a distribution of values of type size_t.

일반적으로, 요소는 이 순서를 설정하기 위해 비교 가능한 값보다 작을 필요가 있습니다: 제공된 어떤 두 요소에서도, 두 요소가 동일하거나(어떤 것도 다른 것보다 작지 않음) 하나가 다른 것보다 작음을 정할 수 있습니다. 그러면 동일하지 않은 요소 사이에 정렬이 수행됩니다. 더 기술적인 설명으로, 비교 함수는 표준 수학 의미로 엄밀한 약한 순서를 포함하는 이진 술어입니다. A binary predicate f(x,y) is a function object that has two argument objects x and y and a return value of true or false. An ordering imposed on a hash_multiset is a strict weak ordering if the binary predicate is irreflexive, antisymmetric, and transitive and if equivalence is transitive, where two objects x and y are defined to be equivalent when both f(x,y) and f(y,x) are false. 더 강력한 키 사이의 상등 조건이 동등 조건을 대체하는 경우, 순서는 전체 (모든 요소들이 서로에 관련하여 정렬됨을 의미) 가 되며, 키의 일치는 서로 식별할 수 없게 됩니다.

제어되는 시퀀스에 있는 요소의 실제 순서는 해시 함수, 정렬 함수 및 컨테이너 개체에 저장 된 해시 테이블의 현재 크기에 따라 달라집니다. 해쉬 테이블의 현재 크기를 지정할 수 없으므로, 일반적으로 제어되는 시퀀스에서 요소의 순서를 예측할 수 없습니다. 요소를 삽입하는 것은 어떤 반복기도 무효화하지 않으며, 요소를 제거하는 것은 제거된 요소를 명확히 가리키고 있는 반복기만을 무효화합니다.

The iterator provided by the hash_multiset class is a bidirectional iterator, but the class member functions insert and hash_multiset have versions that take as template parameters a weaker input iterator, whose functionality requirements are more minimal than those guaranteed by the class of bidirectional iterators. 다른 반복기 개념은 그들의 기능을 정제화하여 연관된 가족을 구성합니다. Each iterator concept has its own hash_multiset of requirements, and the algorithms that work with them must limit their assumptions to the requirements provided by that type of iterator. 일부 개체를 참조하려면 입력 반복기가 역참조될 수 있으며, 이는 시퀀스 내의 다음 반복기를 증가시킬 수 있습니다. This is a minimal hash_multiset of functionality, but it is enough to be able to talk meaningfully about a range of iterators [_First, _Last) in the context of the class member functions.

Visual C++.NET 2003에서, <hash_map><hash_set> 헤더 파일의 멤버는 더 이상 std 네임스페이스에 존재하지 않습니다. 대신 stdext 네임스페이스로 이동되었습니다. 자세한 내용은 stdext 네임스페이스를 참조하십시오.

생성자

hash_multiset

비어 있거나 모든 복사본이거나 또는 일부 다른 hash_multiset 부분인 hash_multiset을 생성 합니다.

형식 정의

allocator_type

형식은 hash_multiset 개체를 위한 allocator 클래스를 나타냅니다.

const_iterator

hash_multiset에 있는 const 요소를 읽을 수 있는 양방향 반복기를 제공하는 형식

const_pointer

hash_multiset에서 const 요소에 대한 포인터를 제공하는 형식입니다.

const_reference

const 작업을 읽고 수행하기 위해 hash_multiset에 저장된 const 요소에 대한 참조를 제공하는 형식입니다.

const_reverse_iterator

hash_multiset에 있는 모든 const 요소를 읽을 수 있는 양방향 반복기를 제공하는 형식

difference_type

A signed integer type that provides the difference between two iterators that address elements within the same hash_multiset.

반복기

hash_multiset에 있는 모든 요소를 읽거나 수정할 수 있는 양방향 반복기를 제공하는 형식입니다.

key_compare

hash_multiset의 두 요소간 상대적 순서를 결정하는 두 정렬 키를 비교할 수 있는 함수 개체를 제공하는 형식입니다.

key_type

A type that describes an object stored as an element of a hash_set in its capacity as sort key.

포인터

다음 hash_multiset 내의 요소에 대한 포인터를 제공하는 형식입니다.

reference

다음 hash_multiset 내에 저장된 요소에 대한 참조를 제공하는 형식입니다.

reverse_iterator

예약된 hash_multiset에 있는 요소를 읽거나 수정할 수 있는 양방향 반복기를 제공하는 형식입니다.

size_type

부호 없는 정수 형식은 hash_multiset의 요소 갯수를 표현할 수 있습니다.

value_compare

A type that provides two function objects, a binary predicate of class compare that can compare two element values of a hash_multiset to determine their relative order and a unary predicate that hashes the elements.

value_type

A type that describes an object stored as an element of a hash_multiset in its capacity as a value.

멤버 함수

begin

Returns an iterator that addresses the first element in the hash_multiset.

hash_multiset::cbegin

hash_multiset에서 첫 번째 요소를 주소 지정하는 상수 반복기를 반환합니다.

hash_multiset::cend

hash_multiset에서 마지막 요소 뒤에 나오는 위치를 주소 지정하는 상수 반복기를 반환합니다.

clear

다음 hash_multiset의 모든 요소를 지웁니다.

count

Returns the number of elements in a hash_multiset whose key matches a parameter-specified key

hash_multiset::crbegin

예약된 hash_multiset에서 첫 번째 요소를 주소 지정하는 상수 반복기를 반환합니다.

hash_multiset::crend

예약된 hash_multiset에서 마지막 요소 뒤에 나오는 위치를 주소 지정하는 상수 반복기를 반환합니다.

hash_multiset::emplace

hash_multiset에 생성된 요소를 삽입합니다.

hash_multiset::emplace_hint

배치 힌트를 사용하여 hash_multiset에 생성된 요소를 삽입합니다.

empty

hash_multiset이 비어 있는지를 테스트합니다.

end

hash_multiset에서 마지막 요소 뒤에 나오는 위치를 주소 지정하는 반복기를 반환합니다.

equal_range

Returns a pair of iterators respectively to the first element in a hash_multiset with a key that is greater than a specified key and to the first element in the hash_multiset with a key that is equal to or greater than the key.

지우기

Removes an element or a range of elements in a hash_multiset from specified positions or removes elements that match a specified key.

find

지정된 키와 같은 키를 가진 hash_multiset 내 요소의 위치를 가리키는 반복기를 반환합니다.

get_allocator

hash_multiset을 생성하는 데 사용되는 allocator 개체의 복사본을 반환합니다.

insert

hash_multiset에 요소 또는 요소의 범위를 삽입합니다.

key_comp

hash_multiset에서 키를 정렬하기 위해 사용되는 비교 개체의 복사본을 검색합니다.

lower_bound

Returns an iterator to the first element in a hash_multiset with a key that is equal to or greater than a specified key.

max_size

hash_multiset의 최대 길이를 반환합니다.

rbegin

예약된 hash_multiset에서 첫 번째 요소를 참조하는 반복기를 반환합니다.

rend

예약된 hash_multiset에서 마지막 요소 뒤에 나오는 위치를 주소 지정하는 반복기를 반환합니다.

size

다음 hash_multiset내에 있는 요소 수를 반환합니다.

스왑

hash_multiset의 요소를 교환합니다.

upper_bound

Returns an iterator to the first element in a hash_multiset that with a key that is equal to or greater than a specified key.

value_comp

Retrieves a copy of the hash traits object used to hash and order element key values in a hash_multiset.

연산자

hash_multiset::operator=

다른 hash_multiset 의 복사본이 hash_multiset 의 요소를 대체합니다.

요구 사항

헤더: <hash_set>

네임스페이스: stdext

참고 항목

참조

C++ 표준 라이브러리의 스레드 보안

표준 템플릿 라이브러리

기타 리소스

<hash_set> 멤버

hash_multiset 멤버