Namespaces
Variants

std::unordered_multiset<Key,Hash,KeyEqual,Allocator>:: unordered_multiset

From cppreference.net

(1)
unordered_multiset ( )
: unordered_multiset ( size_type ( /* unspecified */ ) ) { }
(C++11부터)
(C++20까지)
unordered_multiset ( ) ;
(C++20부터)
explicit unordered_multiset ( size_type bucket_count,

const Hash & hash = Hash ( ) ,
const key_equal & equal = key_equal ( ) ,

const Allocator & alloc = Allocator ( ) ) ;
(2) (C++11 이후)
unordered_multiset ( size_type bucket_count,

const Allocator & alloc )

: unordered_multiset ( bucket_count, Hash ( ) , key_equal ( ) , alloc ) { }
(3) (C++14 이후)
unordered_multiset ( size_type bucket_count,

const Hash & hash,
const Allocator & alloc )

: unordered_multiset ( bucket_count, hash, key_equal ( ) , alloc ) { }
(4) (C++14 이후)
explicit unordered_multiset ( const Allocator & alloc ) ;
(5) (C++11 이후)
template < class InputIt >

unordered_multiset ( InputIt first, InputIt last,
size_type bucket_count = /* 지정되지 않음 */ ,
const Hash & hash = Hash ( ) ,
const key_equal & equal = key_equal ( ) ,

const Allocator & alloc = Allocator ( ) ) ;
(6) (C++11 이후)
template < class InputIt >

unordered_multiset ( InputIt first, InputIt last,
size_type bucket_count,
const Allocator & alloc )
: unordered_multiset ( first, last,

bucket_count, Hash ( ) , key_equal ( ) , alloc ) { }
(7) (C++14 이후)
template < class InputIt >

unordered_multiset ( InputIt first, InputIt last,
size_type bucket_count,
const Hash & hash,
const Allocator & alloc )
: unordered_multiset ( first, last,

bucket_count, hash, key_equal ( ) , alloc ) { }
(8) (C++14 이후)
unordered_multiset ( const unordered_multiset & other ) ;
(9) (C++11 이후)
unordered_multiset ( const unordered_multiset & other, const Allocator & alloc ) ;
(10) (C++11 이후)
unordered_multiset ( unordered_multiset && other ) ;
(11) (C++11 이후)
unordered_multiset ( unordered_multiset && other, const Allocator & alloc ) ;
(12) (C++11 이후)
unordered_multiset ( std:: initializer_list < value_type > init,

size_type bucket_count = /* 지정되지 않음 */ ,
const Hash & hash = Hash ( ) ,
const key_equal & equal = key_equal ( ) ,

const Allocator & alloc = Allocator ( ) ) ;
(13) (C++11 이후)
unordered_multiset ( std:: initializer_list < value_type > init,

size_type bucket_count,
const Allocator & alloc )
: unordered_multiset ( init, bucket_count,

Hash ( ) , key_equal ( ) , alloc ) { }
(14) (C++14부터)
unordered_multiset ( std:: initializer_list < value_type > init,

size_type bucket_count,
const Hash & hash,
const Allocator & alloc )
: unordered_multiset ( init, bucket_count,

hash, key_equal ( ) , alloc ) { }
(15) (C++14부터)
template < container-compatible-range < value_type > R >

unordered_multiset ( std:: from_range_t , R && rg,
size_type bucket_count = /* 설명 참조 */ ,
const Hash & hash = Hash ( ) ,
const key_equal & equal = key_equal ( ) ,

const Allocator & alloc = Allocator ( ) ) ;
(16) (C++23부터)
template < container-compatible-range < value_type > R >

unordered_multiset ( std:: from_range_t , R && rg,
size_type bucket_count,
const Allocator & alloc )
: unordered_multiset ( std:: from_range , std:: forward < R > ( rg ) ,

bucket_count, Hash ( ) , key_equal ( ) , alloc ) { }
(17) (C++23부터)
template < container-compatible-range < value_type > R >

unordered_multiset ( std:: from_range_t , R && rg,
size_type bucket_count,
const Hash & hash,
const Alloc & alloc )
: unordered_multiset ( std:: from_range , std:: forward < R > ( rg ) ,

bucket_count, hash, key_equal ( ) , alloc ) { }
(18) (C++23 이후)

다양한 데이터 소스로부터 새로운 컨테이너를 생성합니다. 선택적으로 사용자가 제공한 bucket_count 를 생성할 최소 버킷 수로 사용하고, hash 를 해시 함수로, equal 를 키 비교 함수로, alloc 를 할당자로 사용합니다.

1-5) 빈 컨테이너를 생성합니다. max_load_factor() 1.0 으로 설정합니다. 기본 생성자의 경우 버킷 수는 명시되지 않습니다.
6-8) 범위 [ first , last ) 의 내용으로 컨테이너를 생성합니다. max_load_factor() 1.0 으로 설정합니다.
9,10) 복사 생성자. 컨테이너를 other 의 내용 사본으로 구성하며, 로드 팩터, predicate 및 해시 함수도 복사합니다. alloc 이 제공되지 않으면, allocator는 std:: allocator_traits < allocator_type > :: select_on_container_copy_construction ( other. get_allocator ( ) ) 를 호출하여 얻습니다.

템플릿 매개변수 Allocator 클래스 템플릿 인수 추론 에서 사용될 때 첫 번째 인수로부터만 추론됩니다.

(C++23 이후)
11,12) 이동 생성자 . 이동 의미론을 사용하여 other 의 내용으로 컨테이너를 생성합니다. alloc 이 제공되지 않으면, other 에 속한 할당자로부터 이동 생성으로 할당자를 획득합니다.

템플릿 매개변수 Allocator 클래스 템플릿 인수 추론 에서 사용될 때 첫 번째 인수로부터만 추론됩니다.

(C++23부터)
13-15) 이니셜라이저 리스트 생성자 . 이니셜라이저 리스트 init 의 내용으로 컨테이너를 생성합니다. unordered_multiset ( init. begin ( ) , init. end ( ) ) 와 동일합니다.
16-18) 컨테이너를 rg 의 내용으로 구성합니다.

목차

매개변수

alloc - 이 컨테이너의 모든 메모리 할당에 사용할 할당자
bucket_count - 초기화 시 사용할 최소 버킷 수. 지정되지 않으면 명시되지 않은 기본값이 사용됨
hash - 사용할 해시 함수
equal - 이 컨테이너의 모든 키 비교에 사용할 비교 함수
first, last - 복사할 요소들의 소스 범위 를 정의하는 반복자 쌍
rg - 컨테이너 호환 범위 , 즉 요소들이 value_type 으로 변환 가능한 input_range
other - 컨테이너의 요소들을 초기화하는 데 사용할 소스로 사용할 다른 컨테이너
init - 컨테이너의 요소들을 초기화하는 데 사용할 초기화자 리스트
타입 요구사항
-
InputIt LegacyInputIterator 요구사항을 충족해야 함.

복잡도

1-5) 상수.
6-8) 평균 케이스 선형 (즉, O(N) , 여기서 N std:: distance ( first, last ) ), 최악 케이스 2차, 즉 O(N 2 ) .
9,10) other 의 크기에 선형적입니다.
11,12) 상수. 만약 alloc 이 주어지고 alloc ! = other. get_allocator ( ) 인 경우, 선형입니다.
13-15) 평균 케이스 O(N) ( N std:: size ( init ) ), 최악의 케이스 O(N 2 ) .
16-18) 평균 경우 O(N) ( N ranges:: distance ( rg ) ), 최악 경우 O(N 2 ) .

예외

Allocator::allocate 에 대한 호출은 예외를 발생시킬 수 있습니다.

참고 사항

After container move construction (overload ( 11,12 ) ), references, pointers, and iterators (other than the end iterator) to other remain valid, but refer to elements that are now in * this . The current standard makes this guarantee via the blanket statement in [container.reqmts]/67 , and a more direct guarantee is under consideration via LWG 이슈 2321 .

C++23까지 공식적으로 요구되지는 않지만, 일부 구현에서는 이미 이전 모드에서 템플릿 매개변수 Allocator 비추론 문맥 에 포함시킨 경우가 있습니다.

기능 테스트 매크로 표준 기능
__cpp_lib_containers_ranges 202202L (C++23) Ranges-aware 생성 및 삽입; 오버로드 ( 16-18 )

예제

결함 보고서

다음 동작 변경 결함 보고서는 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 2193 C++11 기본 생성자 ( 1 ) 가 explicit였음 non-explicit로 변경됨
LWG 2230 C++11 오버로드 ( 13 ) 의 의미론이 명시되지 않았음 명시됨

참고 항목

컨테이너에 값을 할당합니다
(public member function)