Implement deduction guides for unordered_[multi]map

This commit is contained in:
Christian Mazakas
2022-11-07 10:26:59 -08:00
parent 2949b37490
commit 530437c21b

View File

@ -20,6 +20,7 @@
#include <boost/move/move.hpp> #include <boost/move/move.hpp>
#include <boost/type_traits/is_constructible.hpp> #include <boost/type_traits/is_constructible.hpp>
#include <boost/unordered/detail/map.hpp> #include <boost/unordered/detail/map.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>
@ -50,9 +51,9 @@ namespace boost {
typedef K key_type; typedef K key_type;
typedef T mapped_type; typedef T mapped_type;
typedef std::pair<const K, T> value_type; typedef std::pair<const K, T> value_type;
typedef H hasher; typedef typename boost::type_identity<H>::type hasher;
typedef P key_equal; typedef typename boost::type_identity<P>::type key_equal;
typedef A allocator_type; typedef typename boost::type_identity<A>::type allocator_type;
private: private:
typedef boost::unordered::detail::map<A, K, T, H, P> types; typedef boost::unordered::detail::map<A, K, T, H, P> types;
@ -931,7 +932,7 @@ namespace boost {
template <typename T> template <typename T>
using iter_to_alloc_t = using iter_to_alloc_t =
typename std::pair<iter_key_t<T> const, iter_val_t<T> >; typename std::pair<iter_key_t<T> const, iter_val_t<T> >;
} } // namespace detail
template <class InputIterator, template <class InputIterator,
class Hash = class Hash =
@ -939,58 +940,80 @@ namespace boost {
class Pred = class Pred =
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >, std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
class Allocator = std::allocator< 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, unordered_map(InputIterator, InputIterator,
std::size_t = boost::unordered::detail::default_bucket_count, std::size_t = boost::unordered::detail::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 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, boost::unordered::detail::iter_val_t<InputIterator>, Hash, Pred,
Allocator>; Allocator>;
template <class Key, class T, class Hash = boost::hash<Key>, template <class Key, class T,
class Pred = std::equal_to<Key>, class Hash = boost::hash<boost::remove_const_t<Key> >,
class Allocator = std::allocator<std::pair<const Key, T> > > class Pred = std::equal_to<boost::remove_const_t<Key> >,
unordered_map(std::initializer_list<std::pair<const Key, T> >, 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, std::size_t = boost::unordered::detail::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 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(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::unordered::detail::iter_val_t<InputIterator>,
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >, boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >, std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>; 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(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::unordered::detail::iter_val_t<InputIterator>,
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >, boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >, std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>; 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(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, boost::unordered::detail::iter_val_t<InputIterator>, Hash,
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >, std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>; Allocator>;
template <class Key, class T, typename Allocator> template <class Key, class T, class Allocator,
unordered_map( class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
std::initializer_list<std::pair<const Key, T> >, std::size_t, Allocator) unordered_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
->unordered_map<Key, T, boost::hash<Key>, std::equal_to<Key>, Allocator>; 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> template <class Key, class T, class Allocator,
unordered_map(std::initializer_list<std::pair<const Key, T> >, Allocator) class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
->unordered_map<Key, T, boost::hash<Key>, std::equal_to<Key>, 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> template <class Key, class T, class Hash, class Allocator,
unordered_map(std::initializer_list<std::pair<const Key, T> >, std::size_t, class = boost::enable_if_t<detail::is_hash_v<Hash> >,
Hash, Allocator) class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
->unordered_map<Key, T, Hash, std::equal_to<Key>, 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 #endif
@ -1007,9 +1030,9 @@ namespace boost {
typedef K key_type; typedef K key_type;
typedef T mapped_type; typedef T mapped_type;
typedef std::pair<const K, T> value_type; typedef std::pair<const K, T> value_type;
typedef H hasher; typedef typename boost::type_identity<H>::type hasher;
typedef P key_equal; typedef typename boost::type_identity<P>::type key_equal;
typedef A allocator_type; typedef typename boost::type_identity<A>::type allocator_type;
private: private:
typedef boost::unordered::detail::map<A, K, T, H, P> types; typedef boost::unordered::detail::map<A, K, T, H, P> types;
@ -1612,62 +1635,82 @@ namespace boost {
class Pred = class Pred =
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >, std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
class Allocator = std::allocator< 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, unordered_multimap(InputIterator, InputIterator,
std::size_t = boost::unordered::detail::default_bucket_count, std::size_t = boost::unordered::detail::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 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, boost::unordered::detail::iter_val_t<InputIterator>, Hash, Pred,
Allocator>; Allocator>;
template <class Key, class T, class Hash = boost::hash<Key>, template <class Key, class T,
class Pred = std::equal_to<Key>, class Hash = boost::hash<boost::remove_const_t<Key> >,
class Allocator = std::allocator<std::pair<const Key, T> > > class Pred = std::equal_to<boost::remove_const_t<Key> >,
unordered_multimap(std::initializer_list<std::pair<const Key, T> >, 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, std::size_t = boost::unordered::detail::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 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(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::unordered::detail::iter_val_t<InputIterator>,
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >, boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >, std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>; 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(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::unordered::detail::iter_val_t<InputIterator>,
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >, boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >, std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>; 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( unordered_multimap(
InputIterator, InputIterator, std::size_t, Hash, Allocator) 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, boost::unordered::detail::iter_val_t<InputIterator>, Hash,
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >, std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>; Allocator>;
template <class Key, class T, typename Allocator> template <class Key, class T, class Allocator,
unordered_multimap( class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
std::initializer_list<std::pair<const Key, T> >, std::size_t, Allocator) unordered_multimap(std::initializer_list<std::pair<Key, T> >, std::size_t,
->unordered_multimap<Key, T, boost::hash<Key>, std::equal_to<Key>, Allocator) -> unordered_multimap<boost::remove_const_t<Key>, T,
Allocator>; boost::hash<boost::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>;
template <class Key, class T, typename Allocator> template <class Key, class T, class Allocator,
unordered_multimap( class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
std::initializer_list<std::pair<const Key, T> >, Allocator) unordered_multimap(std::initializer_list<std::pair<Key, T> >, Allocator)
->unordered_multimap<Key, T, boost::hash<Key>, std::equal_to<Key>, -> unordered_multimap<boost::remove_const_t<Key>, T,
Allocator>; 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> template <class Key, class T, class Hash, class Allocator,
unordered_multimap(std::initializer_list<std::pair<const Key, T> >, class = boost::enable_if_t<detail::is_hash_v<Hash> >,
std::size_t, Hash, Allocator) class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
->unordered_multimap<Key, T, Hash, std::equal_to<Key>, 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 #endif