Initial implementation of template deduction guides

This commit is contained in:
Daniel James
2017-12-19 12:11:36 +00:00
parent f99dee1917
commit b50e0d610f
5 changed files with 597 additions and 0 deletions

View File

@@ -831,6 +831,81 @@ namespace boost {
#endif
}; // class template unordered_map
#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
namespace detail {
template <typename T>
using iter_key_t =
typename std::iterator_traits<T>::value_type::first_type;
template <typename T>
using iter_val_t =
typename std::iterator_traits<T>::value_type::second_type;
template <typename T>
using iter_to_alloc_t =
typename std::pair<iter_key_t<T> const, iter_val_t<T> >;
}
template <class InputIterator,
class Hash =
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
class Pred =
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
class Allocator = std::allocator<
boost::unordered::detail::iter_to_alloc_t<InputIterator> > >
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>,
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> >,
std::size_t = boost::unordered::detail::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
->unordered_map<Key, T, Hash, Pred, Allocator>;
template <class InputIterator, class Allocator>
unordered_map(InputIterator, InputIterator, std::size_t, Allocator)
->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>
unordered_map(InputIterator, InputIterator, Allocator)
->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>
unordered_map(InputIterator, InputIterator, std::size_t, Hash, Allocator)
->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, 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 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>;
#endif
template <class K, class T, class H, class P, class A>
class unordered_multimap
{
@@ -1363,6 +1438,73 @@ namespace boost {
#endif
}; // class template unordered_multimap
#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
template <class InputIterator,
class Hash =
boost::hash<boost::unordered::detail::iter_key_t<InputIterator> >,
class Pred =
std::equal_to<boost::unordered::detail::iter_key_t<InputIterator> >,
class Allocator = std::allocator<
boost::unordered::detail::iter_to_alloc_t<InputIterator> > >
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>,
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> >,
std::size_t = boost::unordered::detail::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
->unordered_multimap<Key, T, Hash, Pred, Allocator>;
template <class InputIterator, class Allocator>
unordered_multimap(InputIterator, InputIterator, std::size_t, Allocator)
->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>
unordered_multimap(InputIterator, InputIterator, Allocator)
->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>
unordered_multimap(
InputIterator, InputIterator, std::size_t, Hash, Allocator)
->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, 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 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>;
#endif
////////////////////////////////////////////////////////////////////////////
template <class K, class T, class H, class P, class A>