mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 19:07:15 +02:00
Implement deduction guides for unordered_[multi]map
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/type_traits/is_constructible.hpp>
|
||||
#include <boost/unordered/detail/map.hpp>
|
||||
#include <boost/unordered/detail/type_traits.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
@ -50,9 +51,9 @@ namespace boost {
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair<const K, T> value_type;
|
||||
typedef H hasher;
|
||||
typedef P key_equal;
|
||||
typedef A allocator_type;
|
||||
typedef typename boost::type_identity<H>::type hasher;
|
||||
typedef typename boost::type_identity<P>::type key_equal;
|
||||
typedef typename boost::type_identity<A>::type allocator_type;
|
||||
|
||||
private:
|
||||
typedef boost::unordered::detail::map<A, K, T, H, P> types;
|
||||
@ -931,7 +932,7 @@ namespace boost {
|
||||
template <typename T>
|
||||
using iter_to_alloc_t =
|
||||
typename std::pair<iter_key_t<T> const, iter_val_t<T> >;
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <class InputIterator,
|
||||
class Hash =
|
||||
@ -939,58 +940,80 @@ namespace boost {
|
||||
class Pred =
|
||||
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
class Allocator = std::allocator<
|
||||
boost::unordered::detail::iter_to_alloc_t<InputIterator> > >
|
||||
boost::unordered::detail::iter_to_alloc_t<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_hash_v<Hash> >,
|
||||
class = boost::enable_if_t<detail::is_pred_v<Pred> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_map(InputIterator, InputIterator,
|
||||
std::size_t = boost::unordered::detail::default_bucket_count,
|
||||
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
||||
->unordered_map<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
-> unordered_map<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
boost::unordered::detail::iter_val_t<InputIterator>, Hash, Pred,
|
||||
Allocator>;
|
||||
|
||||
template <class Key, class T, class Hash = boost::hash<Key>,
|
||||
class Pred = std::equal_to<Key>,
|
||||
class Allocator = std::allocator<std::pair<const Key, T> > >
|
||||
unordered_map(std::initializer_list<std::pair<const Key, T> >,
|
||||
template <class Key, class T,
|
||||
class Hash = boost::hash<boost::remove_const_t<Key> >,
|
||||
class Pred = std::equal_to<boost::remove_const_t<Key> >,
|
||||
class Allocator = std::allocator<std::pair<const Key, T> >,
|
||||
class = boost::enable_if_t<detail::is_hash_v<Hash> >,
|
||||
class = boost::enable_if_t<detail::is_pred_v<Pred> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_map(std::initializer_list<std::pair<Key, T> >,
|
||||
std::size_t = boost::unordered::detail::default_bucket_count,
|
||||
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
||||
->unordered_map<Key, T, Hash, Pred, Allocator>;
|
||||
-> unordered_map<boost::remove_const_t<Key>, T, Hash, Pred, Allocator>;
|
||||
|
||||
template <class InputIterator, class Allocator>
|
||||
template <class InputIterator, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_map(InputIterator, InputIterator, std::size_t, Allocator)
|
||||
->unordered_map<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
-> unordered_map<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
boost::unordered::detail::iter_val_t<InputIterator>,
|
||||
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
Allocator>;
|
||||
|
||||
template <class InputIterator, class Allocator>
|
||||
template <class InputIterator, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_map(InputIterator, InputIterator, Allocator)
|
||||
->unordered_map<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
-> unordered_map<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
boost::unordered::detail::iter_val_t<InputIterator>,
|
||||
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
Allocator>;
|
||||
|
||||
template <class InputIterator, class Hash, class Allocator>
|
||||
template <class InputIterator, class Hash, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_hash_v<Hash> >,
|
||||
class = boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_map(InputIterator, InputIterator, std::size_t, Hash, Allocator)
|
||||
->unordered_map<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
-> unordered_map<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
boost::unordered::detail::iter_val_t<InputIterator>, Hash,
|
||||
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
Allocator>;
|
||||
|
||||
template <class Key, class T, typename Allocator>
|
||||
unordered_map(
|
||||
std::initializer_list<std::pair<const Key, T> >, std::size_t, Allocator)
|
||||
->unordered_map<Key, T, boost::hash<Key>, std::equal_to<Key>, Allocator>;
|
||||
template <class Key, class T, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
|
||||
Allocator) -> unordered_map<boost::remove_const_t<Key>, T,
|
||||
boost::hash<boost::remove_const_t<Key> >,
|
||||
std::equal_to<boost::remove_const_t<Key> >, Allocator>;
|
||||
|
||||
template <class Key, class T, typename Allocator>
|
||||
unordered_map(std::initializer_list<std::pair<const Key, T> >, Allocator)
|
||||
->unordered_map<Key, T, boost::hash<Key>, std::equal_to<Key>, Allocator>;
|
||||
template <class Key, class T, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_map(std::initializer_list<std::pair<Key, T> >, Allocator)
|
||||
-> unordered_map<boost::remove_const_t<Key>, T,
|
||||
boost::hash<boost::remove_const_t<Key> >,
|
||||
std::equal_to<boost::remove_const_t<Key> >, Allocator>;
|
||||
|
||||
template <class Key, class T, class Hash, class Allocator>
|
||||
unordered_map(std::initializer_list<std::pair<const Key, T> >, std::size_t,
|
||||
Hash, Allocator)
|
||||
->unordered_map<Key, T, Hash, std::equal_to<Key>, Allocator>;
|
||||
template <class Key, class T, class Hash, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_hash_v<Hash> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_map(std::initializer_list<std::pair<Key, T> >, std::size_t, Hash,
|
||||
Allocator) -> unordered_map<boost::remove_const_t<Key>, T, Hash,
|
||||
std::equal_to<boost::remove_const_t<Key> >, Allocator>;
|
||||
|
||||
#endif
|
||||
|
||||
@ -1007,9 +1030,9 @@ namespace boost {
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair<const K, T> value_type;
|
||||
typedef H hasher;
|
||||
typedef P key_equal;
|
||||
typedef A allocator_type;
|
||||
typedef typename boost::type_identity<H>::type hasher;
|
||||
typedef typename boost::type_identity<P>::type key_equal;
|
||||
typedef typename boost::type_identity<A>::type allocator_type;
|
||||
|
||||
private:
|
||||
typedef boost::unordered::detail::map<A, K, T, H, P> types;
|
||||
@ -1612,62 +1635,82 @@ namespace boost {
|
||||
class Pred =
|
||||
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
class Allocator = std::allocator<
|
||||
boost::unordered::detail::iter_to_alloc_t<InputIterator> > >
|
||||
boost::unordered::detail::iter_to_alloc_t<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_hash_v<Hash> >,
|
||||
class = boost::enable_if_t<detail::is_pred_v<Pred> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_multimap(InputIterator, InputIterator,
|
||||
std::size_t = boost::unordered::detail::default_bucket_count,
|
||||
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
||||
->unordered_multimap<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
-> unordered_multimap<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
boost::unordered::detail::iter_val_t<InputIterator>, Hash, Pred,
|
||||
Allocator>;
|
||||
|
||||
template <class Key, class T, class Hash = boost::hash<Key>,
|
||||
class Pred = std::equal_to<Key>,
|
||||
class Allocator = std::allocator<std::pair<const Key, T> > >
|
||||
unordered_multimap(std::initializer_list<std::pair<const Key, T> >,
|
||||
template <class Key, class T,
|
||||
class Hash = boost::hash<boost::remove_const_t<Key> >,
|
||||
class Pred = std::equal_to<boost::remove_const_t<Key> >,
|
||||
class Allocator = std::allocator<std::pair<const Key, T> >,
|
||||
class = boost::enable_if_t<detail::is_hash_v<Hash> >,
|
||||
class = boost::enable_if_t<detail::is_pred_v<Pred> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_multimap(std::initializer_list<std::pair<Key, T> >,
|
||||
std::size_t = boost::unordered::detail::default_bucket_count,
|
||||
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
||||
->unordered_multimap<Key, T, Hash, Pred, Allocator>;
|
||||
-> unordered_multimap<boost::remove_const_t<Key>, T, Hash, Pred,
|
||||
Allocator>;
|
||||
|
||||
template <class InputIterator, class Allocator>
|
||||
template <class InputIterator, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_multimap(InputIterator, InputIterator, std::size_t, Allocator)
|
||||
->unordered_multimap<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
-> unordered_multimap<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
boost::unordered::detail::iter_val_t<InputIterator>,
|
||||
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
Allocator>;
|
||||
|
||||
template <class InputIterator, class Allocator>
|
||||
template <class InputIterator, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_multimap(InputIterator, InputIterator, Allocator)
|
||||
->unordered_multimap<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
-> unordered_multimap<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
boost::unordered::detail::iter_val_t<InputIterator>,
|
||||
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
Allocator>;
|
||||
|
||||
template <class InputIterator, class Hash, class Allocator>
|
||||
template <class InputIterator, class Hash, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_hash_v<Hash> >,
|
||||
class = boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_multimap(
|
||||
InputIterator, InputIterator, std::size_t, Hash, Allocator)
|
||||
->unordered_multimap<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
-> unordered_multimap<boost::unordered::detail::iter_key_t<InputIterator>,
|
||||
boost::unordered::detail::iter_val_t<InputIterator>, Hash,
|
||||
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
|
||||
Allocator>;
|
||||
|
||||
template <class Key, class T, typename Allocator>
|
||||
unordered_multimap(
|
||||
std::initializer_list<std::pair<const Key, T> >, std::size_t, Allocator)
|
||||
->unordered_multimap<Key, T, boost::hash<Key>, std::equal_to<Key>,
|
||||
Allocator>;
|
||||
template <class Key, class T, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_multimap(std::initializer_list<std::pair<Key, T> >, std::size_t,
|
||||
Allocator) -> unordered_multimap<boost::remove_const_t<Key>, T,
|
||||
boost::hash<boost::remove_const_t<Key> >,
|
||||
std::equal_to<boost::remove_const_t<Key> >, Allocator>;
|
||||
|
||||
template <class Key, class T, typename Allocator>
|
||||
unordered_multimap(
|
||||
std::initializer_list<std::pair<const Key, T> >, Allocator)
|
||||
->unordered_multimap<Key, T, boost::hash<Key>, std::equal_to<Key>,
|
||||
Allocator>;
|
||||
template <class Key, class T, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_multimap(std::initializer_list<std::pair<Key, T> >, Allocator)
|
||||
-> unordered_multimap<boost::remove_const_t<Key>, T,
|
||||
boost::hash<boost::remove_const_t<Key> >,
|
||||
std::equal_to<boost::remove_const_t<Key> >, Allocator>;
|
||||
|
||||
template <class Key, class T, class Hash, class Allocator>
|
||||
unordered_multimap(std::initializer_list<std::pair<const Key, T> >,
|
||||
std::size_t, Hash, Allocator)
|
||||
->unordered_multimap<Key, T, Hash, std::equal_to<Key>, Allocator>;
|
||||
template <class Key, class T, class Hash, class Allocator,
|
||||
class = boost::enable_if_t<detail::is_hash_v<Hash> >,
|
||||
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
|
||||
unordered_multimap(std::initializer_list<std::pair<Key, T> >, std::size_t,
|
||||
Hash, Allocator) -> unordered_multimap<boost::remove_const_t<Key>, T,
|
||||
Hash, std::equal_to<boost::remove_const_t<Key> >, Allocator>;
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user