deduction guides for std::unordered_multiset
Min standard notice:
Header: <unordered_set>
1-6) These deduction guides are provided for unordered_multiset to allow deduction from an iterator range (overloads (1,3,4)) and std::initializer_list (overloads (2,5,6)). This overload participates in overload resolution only if InputIt satisfies LegacyInputIterator, Alloc satisfies Allocator, neither Hash nor Pred satisfy Allocator, Hash is not an integral type.
# Declarations
template<
class InputIt,
class Hash = std::hash<typename std::iterator_traits<InputIt>::value_type>,
class Pred = std::equal_to<typename std::iterator_traits<InputIt>::value_type>,
class Alloc = std::allocator<typename std::iterator_traits<InputIt>::value_type> >
unordered_multiset( InputIt, InputIt,
typename /* see below */::size_type = /* see below */,
Hash = Hash(), Pred = Pred(), Alloc = Alloc() )
-> unordered_multiset<typename std::iterator_traits<InputIt>::value_type,
Hash, Pred, Alloc>;
(since C++17)
template< class T,
class Hash = std::hash<T>,
class Pred = std::equal_to<T>,
class Alloc = std::allocator<T> >
unordered_multiset( std::initializer_list<T>,
typename /* see below */::size_type = /* see below */,
Hash = Hash(), Pred = Pred(), Alloc = Alloc() )
-> unordered_multiset<T, Hash, Pred, Alloc>;
(since C++17)
template< class InputIt, class Alloc >
unordered_multiset( InputIt, InputIt, typename /* see below */::size_type, Alloc )
-> unordered_multiset<typename std::iterator_traits<InputIt>::value_type,
std::hash<typename std::iterator_traits<InputIt>::value_type>,
std::equal_to<typename std::iterator_traits<InputIt>::value_type>,
Alloc>;
(since C++17)
template< class InputIt, class Hash, class Alloc >
unordered_multiset( InputIt, InputIt, typename /* see below */::size_type, Hash, Alloc )
-> unordered_multiset<typename std::iterator_traits<InputIt>::value_type, Hash,
std::equal_to<typename std::iterator_traits<InputIt>::value_type>,
Alloc>;
(since C++17)
template< class T, class Alloc >
unordered_multiset( std::initializer_list<T>, typename /* see below */::size_type, Alloc )
-> unordered_multiset<T, std::hash<T>, std::equal_to<T>, Alloc>;
(since C++17)
template< class T, class Hash, class Alloc >
unordered_multiset( std::initializer_list<T>, typename /* see below */::size_type,
Hash, Alloc )
-> unordered_multiset<T, Hash, std::equal_to<T>, Alloc>;
(since C++17)
template< ranges::input_range R,
class Hash = std::hash<ranges::range_value_t<R>>,
class Pred = std::equal_to<ranges::range_value_t<R>>,
class Alloc = std::allocator<ranges::range_value_t<R>> >
unordered_multiset( std::from_range_t, R&&,
typename /* see below */::size_type = /* see below */,
Hash = Hash(), Pred = Pred(), Alloc = Alloc() )
-> unordered_multiset<ranges::range_value_t<R>, Hash, Pred, Alloc>;
(since C++23)
template< ranges::input_range R, class Alloc >
unordered_multiset( std::from_range_t, R&&,
typename /* see below */::size_type, Alloc )
-> unordered_multiset<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
std::equal_to<ranges::range_value_t<R>>, Alloc>;
(since C++23)
template< ranges::input_range R, class Alloc >
unordered_multiset( std::from_range_t, R&&, Alloc )
-> unordered_multiset<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
std::equal_to<ranges::range_value_t<R>>, Alloc>;
(since C++23)
template< ranges::input_range R, class Hash, class Alloc >
unordered_multiset( std::from_range_t, R&&,
typename /* see below */::size_type, Hash, Alloc )
-> unordered_multiset<ranges::range_value_t<R>, Hash,
std::equal_to<ranges::range_value_t<R>>, Alloc>;
(since C++23)
# Notes
Feature-test macro Value Std Feature __cpp_lib_containers_ranges 202202L (C++23) Ranges-aware construction and insertion; overloads (7-10)
# Example
#include <unordered_set>
int main()
{
// guide #2 deduces std::unordered_multiset<int>
std::unordered_multiset s = {1, 2, 3, 4};
// guide #1 deduces std::unordered_multiset<int>
std::unordered_multiset s2(s.begin(), s.end());
}