Remove dependency on TypeTraits

This commit is contained in:
Christian Mazakas
2023-09-20 12:57:07 -07:00
parent 96170d56a9
commit b61c5614eb
18 changed files with 240 additions and 220 deletions

View File

@ -21,7 +21,6 @@
#include <boost/container_hash/hash.hpp> #include <boost/container_hash/hash.hpp>
#include <boost/core/allocator_access.hpp> #include <boost/core/allocator_access.hpp>
#include <boost/core/serialization.hpp> #include <boost/core/serialization.hpp>
#include <boost/type_traits/type_identity.hpp>
#include <type_traits> #include <type_traits>
@ -65,9 +64,9 @@ namespace boost {
using init_type = typename type_policy::init_type; using init_type = typename type_policy::init_type;
using size_type = std::size_t; using size_type = std::size_t;
using difference_type = std::ptrdiff_t; using difference_type = std::ptrdiff_t;
using hasher = typename boost::type_identity<Hash>::type; using hasher = typename boost::unordered::detail::type_identity<Hash>::type;
using key_equal = typename boost::type_identity<Pred>::type; using key_equal = typename boost::unordered::detail::type_identity<Pred>::type;
using allocator_type = typename boost::type_identity<Allocator>::type; using allocator_type = typename boost::unordered::detail::type_identity<Allocator>::type;
using reference = value_type&; using reference = value_type&;
using const_reference = value_type const&; using const_reference = value_type const&;
using pointer = typename boost::allocator_pointer<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type;
@ -757,8 +756,8 @@ namespace boost {
Allocator>; Allocator>;
template <class Key, class T, template <class Key, class T,
class Hash = boost::hash<boost::remove_const_t<Key> >, class Hash = boost::hash<std::remove_const_t<Key> >,
class Pred = std::equal_to<boost::remove_const_t<Key> >, class Pred = std::equal_to<std::remove_const_t<Key> >,
class Allocator = std::allocator<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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_pred_v<Pred> >, class = boost::enable_if_t<detail::is_pred_v<Pred> >,
@ -766,7 +765,7 @@ namespace boost {
concurrent_flat_map(std::initializer_list<std::pair<Key, T> >, concurrent_flat_map(std::initializer_list<std::pair<Key, T> >,
std::size_t = boost::unordered::detail::foa::default_bucket_count, std::size_t = boost::unordered::detail::foa::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator()) Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> concurrent_flat_map<boost::remove_const_t<Key>, T, Hash, Pred, -> concurrent_flat_map<std::remove_const_t<Key>, T, Hash, Pred,
Allocator>; Allocator>;
template <class InputIterator, class Allocator, template <class InputIterator, class Allocator,
@ -806,23 +805,23 @@ namespace boost {
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
concurrent_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t, concurrent_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Allocator) -> concurrent_flat_map<boost::remove_const_t<Key>, T, Allocator) -> concurrent_flat_map<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
concurrent_flat_map(std::initializer_list<std::pair<Key, T> >, Allocator) concurrent_flat_map(std::initializer_list<std::pair<Key, T> >, Allocator)
-> concurrent_flat_map<boost::remove_const_t<Key>, T, -> concurrent_flat_map<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Hash, class 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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
concurrent_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t, concurrent_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Hash, Allocator) -> concurrent_flat_map<boost::remove_const_t<Key>, T, Hash, Allocator) -> concurrent_flat_map<std::remove_const_t<Key>, T,
Hash, std::equal_to<boost::remove_const_t<Key> >, Allocator>; Hash, std::equal_to<std::remove_const_t<Key> >, Allocator>;
#endif #endif

View File

@ -22,7 +22,6 @@
#include <boost/container_hash/hash.hpp> #include <boost/container_hash/hash.hpp>
#include <boost/core/allocator_access.hpp> #include <boost/core/allocator_access.hpp>
#include <boost/core/serialization.hpp> #include <boost/core/serialization.hpp>
#include <boost/type_traits/type_identity.hpp>
#include <utility> #include <utility>
@ -60,9 +59,9 @@ namespace boost {
using init_type = typename type_policy::init_type; using init_type = typename type_policy::init_type;
using size_type = std::size_t; using size_type = std::size_t;
using difference_type = std::ptrdiff_t; using difference_type = std::ptrdiff_t;
using hasher = typename boost::type_identity<Hash>::type; using hasher = typename boost::unordered::detail::type_identity<Hash>::type;
using key_equal = typename boost::type_identity<Pred>::type; using key_equal = typename boost::unordered::detail::type_identity<Pred>::type;
using allocator_type = typename boost::type_identity<Allocator>::type; using allocator_type = typename boost::unordered::detail::type_identity<Allocator>::type;
using reference = value_type&; using reference = value_type&;
using const_reference = value_type const&; using const_reference = value_type const&;
using pointer = typename boost::allocator_pointer<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type;

View File

@ -9,13 +9,13 @@
#ifndef BOOST_UNORDERED_DETAIL_ARCHIVE_CONSTRUCTED_HPP #ifndef BOOST_UNORDERED_DETAIL_ARCHIVE_CONSTRUCTED_HPP
#define BOOST_UNORDERED_DETAIL_ARCHIVE_CONSTRUCTED_HPP #define BOOST_UNORDERED_DETAIL_ARCHIVE_CONSTRUCTED_HPP
#include <boost/unordered/detail/opt_storage.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/core/addressof.hpp> #include <boost/core/addressof.hpp>
#include <boost/core/no_exceptions_support.hpp> #include <boost/core/no_exceptions_support.hpp>
#include <boost/core/noncopyable.hpp> #include <boost/core/noncopyable.hpp>
#include <boost/core/serialization.hpp> #include <boost/core/serialization.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/alignment_of.hpp>
namespace boost{ namespace boost{
namespace unordered{ namespace unordered{
@ -54,7 +54,7 @@ struct archive_constructed:private noncopyable
#pragma GCC diagnostic ignored "-Wstrict-aliasing" #pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif #endif
T& get(){return *reinterpret_cast<T*>(&space);} T& get(){return *space.address();}
#if defined(BOOST_UNORDERED_IGNORE_WSTRICT_ALIASING) #if defined(BOOST_UNORDERED_IGNORE_WSTRICT_ALIASING)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -62,7 +62,7 @@ struct archive_constructed:private noncopyable
#endif #endif
private: private:
typename aligned_storage<sizeof(T),alignment_of<T>::value>::type space; opt_storage<T> space;
}; };
} /* namespace detail */ } /* namespace detail */

View File

@ -115,6 +115,7 @@ to normal separate chaining implementations.
#include <boost/unordered/detail/prime_fmod.hpp> #include <boost/unordered/detail/prime_fmod.hpp>
#include <boost/unordered/detail/serialize_tracked_address.hpp> #include <boost/unordered/detail/serialize_tracked_address.hpp>
#include <boost/unordered/detail/opt_storage.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/addressof.hpp> #include <boost/core/addressof.hpp>
@ -125,8 +126,6 @@ to normal separate chaining implementations.
#include <boost/core/no_exceptions_support.hpp> #include <boost/core/no_exceptions_support.hpp>
#include <boost/core/serialization.hpp> #include <boost/core/serialization.hpp>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
@ -143,19 +142,18 @@ namespace boost {
node>::type node_pointer; node>::type node_pointer;
node_pointer next; node_pointer next;
typename boost::aligned_storage<sizeof(value_type), opt_storage<value_type> buf;
boost::alignment_of<value_type>::value>::type buf;
node() noexcept : next(), buf() {} node() noexcept : next(), buf() {}
value_type* value_ptr() noexcept value_type* value_ptr() noexcept
{ {
return reinterpret_cast<value_type*>(buf.address()); return buf.address();
} }
value_type& value() noexcept value_type& value() noexcept
{ {
return *reinterpret_cast<value_type*>(buf.address()); return *buf.address();
} }
}; };

View File

@ -22,13 +22,10 @@
#include <boost/core/pointer_traits.hpp> #include <boost/core/pointer_traits.hpp>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/predef.h> #include <boost/predef.h>
#include <boost/type_traits/has_trivial_constructor.hpp>
#include <boost/type_traits/has_trivial_copy.hpp>
#include <boost/type_traits/has_trivial_assign.hpp>
#include <boost/type_traits/is_nothrow_swappable.hpp>
#include <boost/unordered/detail/narrow_cast.hpp> #include <boost/unordered/detail/narrow_cast.hpp>
#include <boost/unordered/detail/mulx.hpp> #include <boost/unordered/detail/mulx.hpp>
#include <boost/unordered/detail/static_assert.hpp> #include <boost/unordered/detail/static_assert.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/unordered/hash_traits.hpp> #include <boost/unordered/hash_traits.hpp>
#include <climits> #include <climits>
#include <cmath> #include <cmath>
@ -133,10 +130,10 @@
#define BOOST_UNORDERED_THREAD_SANITIZER #define BOOST_UNORDERED_THREAD_SANITIZER
#endif #endif
#define BOOST_UNORDERED_STATIC_ASSERT_HASH_PRED(Hash, Pred) \ #define BOOST_UNORDERED_STATIC_ASSERT_HASH_PRED(Hash, Pred) \
static_assert(boost::is_nothrow_swappable<Hash>::value, \ static_assert(boost::unordered::detail::is_nothrow_swappable<Hash>::value, \
"Template parameter Hash is required to be nothrow Swappable."); \ "Template parameter Hash is required to be nothrow Swappable."); \
static_assert(boost::is_nothrow_swappable<Pred>::value, \ static_assert(boost::unordered::detail::is_nothrow_swappable<Pred>::value, \
"Template parameter Pred is required to be nothrow Swappable"); "Template parameter Pred is required to be nothrow Swappable");
namespace boost{ namespace boost{
@ -1054,13 +1051,7 @@ struct table_arrays
initialize_groups( initialize_groups(
arrays.groups(),groups_size, arrays.groups(),groups_size,
std::integral_constant< std::integral_constant<
bool, bool,std::is_trivially_constructible<group_type>::value
#if BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION,<50000)
/* std::is_trivially_constructible not provided */
boost::has_trivial_constructor<group_type>::value
#else
std::is_trivially_constructible<group_type>::value
#endif
>{}); >{});
arrays.groups()[groups_size-1].set_sentinel(); arrays.groups()[groups_size-1].set_sentinel();
} }

View File

@ -9,6 +9,8 @@
#ifndef BOOST_UNORDERED_DETAIL_FOA_NODE_HANDLE_HPP #ifndef BOOST_UNORDERED_DETAIL_FOA_NODE_HANDLE_HPP
#define BOOST_UNORDERED_DETAIL_FOA_NODE_HANDLE_HPP #define BOOST_UNORDERED_DETAIL_FOA_NODE_HANDLE_HPP
#include <boost/unordered/detail/opt_storage.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/core/allocator_access.hpp> #include <boost/core/allocator_access.hpp>
@ -25,14 +27,6 @@ struct insert_return_type
NodeType node; NodeType node;
}; };
template <class T>
union opt_storage {
BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS T t_;
opt_storage(){}
~opt_storage(){}
};
template <class TypePolicy,class Allocator> template <class TypePolicy,class Allocator>
struct node_handle_base struct node_handle_base
{ {

View File

@ -16,6 +16,7 @@
#include <boost/unordered/detail/fca.hpp> #include <boost/unordered/detail/fca.hpp>
#include <boost/unordered/detail/fwd.hpp> #include <boost/unordered/detail/fwd.hpp>
#include <boost/unordered/detail/opt_storage.hpp>
#include <boost/unordered/detail/serialize_tracked_address.hpp> #include <boost/unordered/detail/serialize_tracked_address.hpp>
#include <boost/unordered/detail/static_assert.hpp> #include <boost/unordered/detail/static_assert.hpp>
#include <boost/unordered/detail/type_traits.hpp> #include <boost/unordered/detail/type_traits.hpp>
@ -31,20 +32,6 @@
#include <boost/mp11/algorithm.hpp> #include <boost/mp11/algorithm.hpp>
#include <boost/mp11/list.hpp> #include <boost/mp11/list.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/type_traits/add_lvalue_reference.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_empty.hpp>
#include <boost/type_traits/is_nothrow_move_assignable.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
#include <boost/type_traits/is_nothrow_swappable.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/make_void.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
@ -124,7 +111,7 @@ namespace boost {
// iterator SFINAE // iterator SFINAE
template <typename I> template <typename I>
struct is_forward : boost::is_base_of<std::forward_iterator_tag, struct is_forward : std::is_base_of<std::forward_iterator_tag,
typename std::iterator_traits<I>::iterator_category> typename std::iterator_traits<I>::iterator_category>
{ {
}; };
@ -292,8 +279,7 @@ namespace boost {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Bits and pieces for implementing traits // Bits and pieces for implementing traits
template <typename T> template <typename T> typename std::add_lvalue_reference<T>::type make();
typename boost::add_lvalue_reference<T>::type make();
struct choice9 struct choice9
{ {
typedef char (&type)[9]; typedef char (&type)[9];
@ -385,8 +371,7 @@ namespace boost {
{ {
typedef ValueType value_type; typedef ValueType value_type;
typename boost::aligned_storage<sizeof(value_type), opt_storage<value_type> data_;
boost::alignment_of<value_type>::value>::type data_;
value_base() : data_() {} value_base() : data_() {}
@ -865,26 +850,23 @@ namespace boost {
{ {
public: public:
static const bool nothrow_move_assignable = static const bool nothrow_move_assignable =
boost::is_nothrow_move_assignable<H>::value && std::is_nothrow_move_assignable<H>::value &&
boost::is_nothrow_move_assignable<P>::value; std::is_nothrow_move_assignable<P>::value;
static const bool nothrow_move_constructible = static const bool nothrow_move_constructible =
boost::is_nothrow_move_constructible<H>::value && std::is_nothrow_move_constructible<H>::value &&
boost::is_nothrow_move_constructible<P>::value; std::is_nothrow_move_constructible<P>::value;
static const bool nothrow_swappable = static const bool nothrow_swappable =
boost::is_nothrow_swappable<H>::value && boost::unordered::detail::is_nothrow_swappable<H>::value &&
boost::is_nothrow_swappable<P>::value; boost::unordered::detail::is_nothrow_swappable<P>::value;
private: private:
functions& operator=(functions const&); functions& operator=(functions const&);
typedef compressed<H, P> function_pair; typedef compressed<H, P> function_pair;
typedef typename boost::aligned_storage<sizeof(function_pair),
boost::alignment_of<function_pair>::value>::type aligned_function;
unsigned char current_; // 0/1 - Currently active functions unsigned char current_; // 0/1 - Currently active functions
// +2 - Both constructed // +2 - Both constructed
aligned_function funcs_[2]; opt_storage<function_pair> funcs_[2];
public: public:
functions(H const& hf, P const& eq) : current_(0) functions(H const& hf, P const& eq) : current_(0)
@ -2138,8 +2120,8 @@ namespace boost {
void merge_unique(boost::unordered::detail::table<Types2>& other) void merge_unique(boost::unordered::detail::table<Types2>& other)
{ {
typedef boost::unordered::detail::table<Types2> other_table; typedef boost::unordered::detail::table<Types2> other_table;
BOOST_UNORDERED_STATIC_ASSERT(( BOOST_UNORDERED_STATIC_ASSERT(
boost::is_same<node_type, typename other_table::node_type>::value)); (std::is_same<node_type, typename other_table::node_type>::value));
BOOST_ASSERT(this->node_alloc() == other.node_alloc()); BOOST_ASSERT(this->node_alloc() == other.node_alloc());
if (other.size_ == 0) { if (other.size_ == 0) {
@ -2816,8 +2798,7 @@ namespace boost {
sizeof(choice2::type) sizeof(choice2::type)
}; };
typedef typedef typename std::conditional<value, Key const&, no_key>::type type;
typename boost::conditional<value, Key const&, no_key>::type type;
}; };
template <class ValueType> struct set_extractor template <class ValueType> struct set_extractor
@ -2846,7 +2827,7 @@ namespace boost {
template <class ValueType> struct map_extractor template <class ValueType> struct map_extractor
{ {
typedef ValueType value_type; typedef ValueType value_type;
typedef typename boost::remove_const<typename boost::unordered::detail:: typedef typename std::remove_const<typename boost::unordered::detail::
pair_traits<ValueType>::first_type>::type key_type; pair_traits<ValueType>::first_type>::type key_type;
static key_type const& extract(value_type const& v) { return v.first; } static key_type const& extract(value_type const& v) { return v.first; }

View File

@ -12,8 +12,7 @@
#include <boost/unordered/detail/static_assert.hpp> #include <boost/unordered/detail/static_assert.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/type_traits/is_integral.hpp> #include <type_traits>
#include <boost/type_traits/make_unsigned.hpp>
namespace boost{ namespace boost{
namespace unordered{ namespace unordered{
@ -22,8 +21,8 @@ namespace detail{
template<typename To,typename From> template<typename To,typename From>
constexpr To narrow_cast(From x) noexcept constexpr To narrow_cast(From x) noexcept
{ {
BOOST_UNORDERED_STATIC_ASSERT(boost::is_integral<From>::value); BOOST_UNORDERED_STATIC_ASSERT(std::is_integral<From>::value);
BOOST_UNORDERED_STATIC_ASSERT(boost::is_integral<To>::value); BOOST_UNORDERED_STATIC_ASSERT(std::is_integral<To>::value);
BOOST_UNORDERED_STATIC_ASSERT(sizeof(From)>=sizeof(To)); BOOST_UNORDERED_STATIC_ASSERT(sizeof(From)>=sizeof(To));
return static_cast<To>( return static_cast<To>(
@ -33,7 +32,7 @@ constexpr To narrow_cast(From x) noexcept
/* Avoids VS's "Run-Time Check Failure #1 - A cast to a smaller data type /* Avoids VS's "Run-Time Check Failure #1 - A cast to a smaller data type
* has caused a loss of data." * has caused a loss of data."
*/ */
&static_cast<typename boost::make_unsigned<To>::type>(~static_cast<To>(0)) &static_cast<typename std::make_unsigned<To>::type>(~static_cast<To>(0))
#endif #endif
); );
} }

View File

@ -0,0 +1,24 @@
#ifndef BOOST_UNORDERED_DETAIL_OPT_STORAGE_HPP
#define BOOST_UNORDERED_DETAIL_OPT_STORAGE_HPP
#include <boost/config.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace unordered {
namespace detail {
template <class T> union opt_storage
{
BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS T t_;
opt_storage() {}
~opt_storage() {}
T* address() noexcept { return boost::addressof(t_); }
T const* address() const noexcept { return boost::addressof(t_); }
};
} // namespace detail
} // namespace unordered
} // namespace boost
#endif // BOOST_UNORDERED_DETAIL_OPT_STORAGE_HPP

View File

@ -12,8 +12,6 @@
#include <boost/core/addressof.hpp> #include <boost/core/addressof.hpp>
#include <boost/core/serialization.hpp> #include <boost/core/serialization.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/unordered/detail/archive_constructed.hpp> #include <boost/unordered/detail/archive_constructed.hpp>
#include <boost/unordered/detail/bad_archive_exception.hpp> #include <boost/unordered/detail/bad_archive_exception.hpp>
#include <boost/unordered/detail/serialization_version.hpp> #include <boost/unordered/detail/serialization_version.hpp>
@ -109,9 +107,9 @@ template<typename Map> struct load_or_save_unordered_map<Map,true> /* save */
template<typename Archive> template<typename Archive>
void operator()(Archive& ar,const Map& x,unsigned int)const void operator()(Archive& ar,const Map& x,unsigned int)const
{ {
typedef typename boost::remove_const< typedef typename std::remove_const<
typename Map::key_type>::type key_type; typename Map::key_type>::type key_type;
typedef typename boost::remove_const< typedef typename std::remove_const<
typename Map::mapped_type>::type mapped_type; typename Map::mapped_type>::type mapped_type;
typedef typename Map::const_iterator const_iterator; typedef typename Map::const_iterator const_iterator;
@ -146,9 +144,9 @@ template<typename Map> struct load_or_save_unordered_map<Map,false> /* load */
template<typename Archive> template<typename Archive>
void operator()(Archive& ar,Map& x,unsigned int)const void operator()(Archive& ar,Map& x,unsigned int)const
{ {
typedef typename boost::remove_const< typedef typename std::remove_const<
typename Map::key_type>::type key_type; typename Map::key_type>::type key_type;
typedef typename boost::remove_const< typedef typename std::remove_const<
typename Map::mapped_type>::type mapped_type; typename Map::mapped_type>::type mapped_type;
typedef typename Map::iterator iterator; typedef typename Map::iterator iterator;
@ -195,7 +193,7 @@ void serialize_container(Archive& ar,Container& x,unsigned int version)
{ {
load_or_save_container< load_or_save_container<
Container, Container,
boost::is_same< std::is_same<
typename Container::key_type,typename Container::value_type>::value, typename Container::key_type,typename Container::value_type>::value,
Archive::is_saving::value>()(ar,x,version); Archive::is_saving::value>()(ar,x,version);
} }

View File

@ -9,12 +9,13 @@
#ifndef BOOST_UNORDERED_DETAIL_SERIALIZE_TRACKED_ADDRESS_HPP #ifndef BOOST_UNORDERED_DETAIL_SERIALIZE_TRACKED_ADDRESS_HPP
#define BOOST_UNORDERED_DETAIL_SERIALIZE_TRACKED_ADDRESS_HPP #define BOOST_UNORDERED_DETAIL_SERIALIZE_TRACKED_ADDRESS_HPP
#include <boost/unordered/detail/bad_archive_exception.hpp>
#include <boost/core/pointer_traits.hpp> #include <boost/core/pointer_traits.hpp>
#include <boost/core/serialization.hpp> #include <boost/core/serialization.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/integral_constant.hpp> #include <type_traits>
#include <boost/unordered/detail/bad_archive_exception.hpp>
namespace boost{ namespace boost{
namespace unordered{ namespace unordered{
@ -44,7 +45,7 @@ template<typename Archive,typename Ptr>
void track_address(Archive& ar,Ptr p) void track_address(Archive& ar,Ptr p)
{ {
typedef typename boost::pointer_traits<Ptr> ptr_traits; typedef typename boost::pointer_traits<Ptr> ptr_traits;
typedef typename boost::remove_const< typedef typename std::remove_const<
typename ptr_traits::element_type>::type element_type; typename ptr_traits::element_type>::type element_type;
if(p){ if(p){
@ -57,10 +58,10 @@ void track_address(Archive& ar,Ptr p)
} }
template<typename Archive,typename Ptr> template<typename Archive,typename Ptr>
void serialize_tracked_address(Archive& ar,Ptr& p,boost::true_type /* save */) void serialize_tracked_address(Archive& ar,Ptr& p,std::true_type /* save */)
{ {
typedef typename boost::pointer_traits<Ptr> ptr_traits; typedef typename boost::pointer_traits<Ptr> ptr_traits;
typedef typename boost::remove_const< typedef typename std::remove_const<
typename ptr_traits::element_type>::type element_type; typename ptr_traits::element_type>::type element_type;
typedef serialization_tracker<element_type> tracker; typedef serialization_tracker<element_type> tracker;
@ -73,10 +74,10 @@ void serialize_tracked_address(Archive& ar,Ptr& p,boost::true_type /* save */)
} }
template<typename Archive,typename Ptr> template<typename Archive,typename Ptr>
void serialize_tracked_address(Archive& ar,Ptr& p,boost::false_type /* load */) void serialize_tracked_address(Archive& ar,Ptr& p,std::false_type /* load */)
{ {
typedef typename boost::pointer_traits<Ptr> ptr_traits; typedef typename boost::pointer_traits<Ptr> ptr_traits;
typedef typename boost::remove_const< typedef typename std::remove_const<
typename ptr_traits::element_type>::type element_type; typename ptr_traits::element_type>::type element_type;
typedef serialization_tracker<element_type> tracker; typedef serialization_tracker<element_type> tracker;
@ -93,7 +94,7 @@ void serialize_tracked_address(Archive& ar,Ptr& p)
{ {
serialize_tracked_address( serialize_tracked_address(
ar,p, ar,p,
boost::integral_constant<bool,Archive::is_saving::value>()); std::integral_constant<bool,Archive::is_saving::value>());
} }
} /* namespace detail */ } /* namespace detail */

View File

@ -11,20 +11,13 @@
#pragma once #pragma once
#endif #endif
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/make_void.hpp>
#include <boost/type_traits/type_identity.hpp>
#if !defined(BOOST_NO_CXX17_DEDUCTION_GUIDES) #if !defined(BOOST_NO_CXX17_DEDUCTION_GUIDES)
#include <boost/type_traits/enable_if.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <iterator> #include <iterator>
#include <utility>
#endif #endif
#include <type_traits>
#include <utility>
// BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES // BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
#if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES) #if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES)
@ -40,19 +33,56 @@
namespace boost { namespace boost {
namespace unordered { namespace unordered {
namespace detail { namespace detail {
template <class T> struct type_identity
{
using type = T;
};
template <typename... Ts> struct make_void
{
typedef void type;
};
template <typename... Ts> using void_t = typename make_void<Ts...>::type;
namespace type_traits_detail {
using std::swap;
template <class T, class = void> struct is_nothrow_swappable_helper
{
constexpr static bool const value = false;
};
template <class T>
struct is_nothrow_swappable_helper<T,
void_t<decltype(swap(std::declval<T&>(), std::declval<T&>()))> >
{
constexpr static bool const value =
noexcept(swap(std::declval<T&>(), std::declval<T&>()));
};
} // namespace type_traits_detail
template <class T> struct is_nothrow_swappable
{
constexpr static bool const value =
type_traits_detail::is_nothrow_swappable_helper<T>::value;
};
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Type checkers used for the transparent member functions added by C++20 // Type checkers used for the transparent member functions added by C++20
// and up // and up
template <class, class = void> template <class, class = void>
struct is_transparent : public boost::false_type struct is_transparent : public std::false_type
{ {
}; };
template <class T> template <class T>
struct is_transparent<T, struct is_transparent<T,
typename boost::make_void<typename T::is_transparent>::type> typename boost::unordered::detail::make_void<typename T::is_transparent>::type>
: public boost::true_type : public std::true_type
{ {
}; };
@ -71,8 +101,8 @@ namespace boost {
static bool const value = static bool const value =
are_transparent<Key, hash, key_equal>::value && are_transparent<Key, hash, key_equal>::value &&
!boost::is_convertible<Key, iterator>::value && !std::is_convertible<Key, iterator>::value &&
!boost::is_convertible<Key, const_iterator>::value; !std::is_convertible<Key, const_iterator>::value;
}; };
#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES #if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
@ -81,7 +111,7 @@ namespace boost {
template <class InputIterator> template <class InputIterator>
constexpr bool const is_input_iterator_v = constexpr bool const is_input_iterator_v =
!boost::is_integral<InputIterator>::value; !std::is_integral<InputIterator>::value;
template <class A, class = void> struct is_allocator template <class A, class = void> struct is_allocator
{ {
@ -90,7 +120,7 @@ namespace boost {
template <class A> template <class A>
struct is_allocator<A, struct is_allocator<A,
boost::void_t<typename A::value_type, boost::unordered::detail::void_t<typename A::value_type,
decltype(std::declval<A&>().allocate(std::size_t{}))> > decltype(std::declval<A&>().allocate(std::size_t{}))> >
{ {
constexpr static bool const value = true; constexpr static bool const value = true;
@ -101,7 +131,7 @@ namespace boost {
template <class H> template <class H>
constexpr bool const is_hash_v = constexpr bool const is_hash_v =
!boost::is_integral<H>::value && !is_allocator_v<H>; !std::is_integral<H>::value && !is_allocator_v<H>;
template <class P> constexpr bool const is_pred_v = !is_allocator_v<P>; template <class P> constexpr bool const is_pred_v = !is_allocator_v<P>;
@ -116,7 +146,7 @@ namespace boost {
typename std::pair<iter_key_t<T> const, iter_val_t<T> >; typename std::pair<iter_key_t<T> const, iter_val_t<T> >;
#endif #endif
} // namespace detail } // namespace detail
} // namespace unordered } // namespace unordered
} // namespace boost } // namespace boost
#endif // BOOST_UNORDERED_DETAIL_TYPE_TRAITS_HPP #endif // BOOST_UNORDERED_DETAIL_TYPE_TRAITS_HPP

View File

@ -11,8 +11,7 @@
#ifndef BOOST_UNORDERED_HASH_TRAITS_HPP #ifndef BOOST_UNORDERED_HASH_TRAITS_HPP
#define BOOST_UNORDERED_HASH_TRAITS_HPP #define BOOST_UNORDERED_HASH_TRAITS_HPP
#include <boost/type_traits/make_void.hpp> #include <boost/unordered/detail/type_traits.hpp>
#include <boost/type_traits/integral_constant.hpp>
namespace boost{ namespace boost{
namespace unordered{ namespace unordered{
@ -20,12 +19,12 @@ namespace unordered{
namespace detail{ namespace detail{
template<typename Hash,typename=void> template<typename Hash,typename=void>
struct hash_is_avalanching_impl: boost::false_type{}; struct hash_is_avalanching_impl: std::false_type{};
template<typename Hash> template<typename Hash>
struct hash_is_avalanching_impl<Hash, struct hash_is_avalanching_impl<Hash,
typename boost::make_void<typename Hash::is_avalanching>::type>: typename boost::unordered::detail::make_void<typename Hash::is_avalanching>::type>:
boost::true_type{}; std::true_type{};
} /* namespace detail */ } /* namespace detail */

View File

@ -65,9 +65,9 @@ namespace boost {
using init_type = typename map_types::init_type; using init_type = typename map_types::init_type;
using size_type = std::size_t; using size_type = std::size_t;
using difference_type = std::ptrdiff_t; using difference_type = std::ptrdiff_t;
using hasher = typename boost::type_identity<Hash>::type; using hasher = typename boost::unordered::detail::type_identity<Hash>::type;
using key_equal = typename boost::type_identity<KeyEqual>::type; using key_equal = typename boost::unordered::detail::type_identity<KeyEqual>::type;
using allocator_type = typename boost::type_identity<Allocator>::type; using allocator_type = typename boost::unordered::detail::type_identity<Allocator>::type;
using reference = value_type&; using reference = value_type&;
using const_reference = value_type const&; using const_reference = value_type const&;
using pointer = typename boost::allocator_pointer<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type;
@ -729,8 +729,8 @@ namespace boost {
Allocator>; Allocator>;
template <class Key, class T, template <class Key, class T,
class Hash = boost::hash<boost::remove_const_t<Key> >, class Hash = boost::hash<std::remove_const_t<Key> >,
class Pred = std::equal_to<boost::remove_const_t<Key> >, class Pred = std::equal_to<std::remove_const_t<Key> >,
class Allocator = std::allocator<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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_pred_v<Pred> >, class = boost::enable_if_t<detail::is_pred_v<Pred> >,
@ -738,7 +738,7 @@ namespace boost {
unordered_flat_map(std::initializer_list<std::pair<Key, T> >, unordered_flat_map(std::initializer_list<std::pair<Key, T> >,
std::size_t = boost::unordered::detail::foa::default_bucket_count, std::size_t = boost::unordered::detail::foa::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator()) Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_flat_map<boost::remove_const_t<Key>, T, Hash, Pred, -> unordered_flat_map<std::remove_const_t<Key>, T, Hash, Pred,
Allocator>; Allocator>;
template <class InputIterator, class Allocator, template <class InputIterator, class Allocator,
@ -775,23 +775,23 @@ namespace boost {
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t, unordered_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Allocator) -> unordered_flat_map<boost::remove_const_t<Key>, T, Allocator) -> unordered_flat_map<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(std::initializer_list<std::pair<Key, T> >, Allocator) unordered_flat_map(std::initializer_list<std::pair<Key, T> >, Allocator)
-> unordered_flat_map<boost::remove_const_t<Key>, T, -> unordered_flat_map<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Hash, class 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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t, unordered_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Hash, Allocator) -> unordered_flat_map<boost::remove_const_t<Key>, T, Hash, Allocator) -> unordered_flat_map<std::remove_const_t<Key>, T,
Hash, std::equal_to<boost::remove_const_t<Key> >, Allocator>; Hash, std::equal_to<std::remove_const_t<Key> >, Allocator>;
#endif #endif
} // namespace unordered } // namespace unordered

View File

@ -21,7 +21,6 @@
#include <boost/core/explicit_operator_bool.hpp> #include <boost/core/explicit_operator_bool.hpp>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include <boost/type_traits/is_constructible.hpp>
#include <initializer_list> #include <initializer_list>
@ -47,9 +46,11 @@ 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 typename boost::type_identity<H>::type hasher; typedef typename boost::unordered::detail::type_identity<H>::type hasher;
typedef typename boost::type_identity<P>::type key_equal; typedef
typedef typename boost::type_identity<A>::type allocator_type; typename boost::unordered::detail::type_identity<P>::type key_equal;
typedef typename boost::unordered::detail::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;
@ -147,8 +148,8 @@ namespace boost {
unordered_map& operator=(unordered_map&& x) unordered_map& operator=(unordered_map&& x)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& std::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) std::is_nothrow_move_assignable<P>::value)
{ {
table_.move_assign(x.table_, std::true_type()); table_.move_assign(x.table_, std::true_type());
return *this; return *this;
@ -220,7 +221,7 @@ namespace boost {
} }
template <class P2> template <class P2>
typename boost::enable_if<boost::is_constructible<value_type, P2&&>, typename boost::enable_if<std::is_constructible<value_type, P2&&>,
std::pair<iterator, bool> >::type std::pair<iterator, bool> >::type
insert(P2&& obj) insert(P2&& obj)
{ {
@ -238,7 +239,7 @@ namespace boost {
} }
template <class P2> template <class P2>
typename boost::enable_if<boost::is_constructible<value_type, P2&&>, typename boost::enable_if<std::is_constructible<value_type, P2&&>,
iterator>::type iterator>::type
insert(const_iterator hint, P2&& obj) insert(const_iterator hint, P2&& obj)
{ {
@ -399,8 +400,8 @@ namespace boost {
void swap(unordered_map&) void swap(unordered_map&)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::unordered::detail::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value); boost::unordered::detail::is_nothrow_swappable<P>::value);
void clear() noexcept { table_.clear_impl(); } void clear() noexcept { table_.clear_impl(); }
template <typename H2, typename P2> template <typename H2, typename P2>
@ -618,8 +619,8 @@ namespace boost {
Allocator>; Allocator>;
template <class Key, class T, template <class Key, class T,
class Hash = boost::hash<boost::remove_const_t<Key> >, class Hash = boost::hash<std::remove_const_t<Key> >,
class Pred = std::equal_to<boost::remove_const_t<Key> >, class Pred = std::equal_to<std::remove_const_t<Key> >,
class Allocator = std::allocator<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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_pred_v<Pred> >, class = boost::enable_if_t<detail::is_pred_v<Pred> >,
@ -627,7 +628,7 @@ namespace boost {
unordered_map(std::initializer_list<std::pair<Key, T> >, 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<boost::remove_const_t<Key>, T, Hash, Pred, Allocator>; -> unordered_map<std::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_input_iterator_v<InputIterator> >,
@ -662,23 +663,23 @@ namespace boost {
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_map(std::initializer_list<std::pair<Key, T> >, std::size_t, unordered_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Allocator) -> unordered_map<boost::remove_const_t<Key>, T, Allocator) -> unordered_map<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_map(std::initializer_list<std::pair<Key, T> >, Allocator) unordered_map(std::initializer_list<std::pair<Key, T> >, Allocator)
-> unordered_map<boost::remove_const_t<Key>, T, -> unordered_map<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Hash, class 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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_map(std::initializer_list<std::pair<Key, T> >, std::size_t, Hash, unordered_map(std::initializer_list<std::pair<Key, T> >, std::size_t, Hash,
Allocator) -> unordered_map<boost::remove_const_t<Key>, T, Hash, Allocator) -> unordered_map<std::remove_const_t<Key>, T, Hash,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
#endif #endif
@ -692,9 +693,11 @@ 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 typename boost::type_identity<H>::type hasher; typedef typename boost::unordered::detail::type_identity<H>::type hasher;
typedef typename boost::type_identity<P>::type key_equal; typedef
typedef typename boost::type_identity<A>::type allocator_type; typename boost::unordered::detail::type_identity<P>::type key_equal;
typedef typename boost::unordered::detail::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;
@ -793,8 +796,8 @@ namespace boost {
unordered_multimap& operator=(unordered_multimap&& x) unordered_multimap& operator=(unordered_multimap&& x)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& std::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) std::is_nothrow_move_assignable<P>::value)
{ {
table_.move_assign(x.table_, std::false_type()); table_.move_assign(x.table_, std::false_type());
return *this; return *this;
@ -860,7 +863,7 @@ namespace boost {
iterator insert(value_type&& x) { return this->emplace(std::move(x)); } iterator insert(value_type&& x) { return this->emplace(std::move(x)); }
template <class P2> template <class P2>
typename boost::enable_if<boost::is_constructible<value_type, P2&&>, typename boost::enable_if<std::is_constructible<value_type, P2&&>,
iterator>::type iterator>::type
insert(P2&& obj) insert(P2&& obj)
{ {
@ -878,7 +881,7 @@ namespace boost {
} }
template <class P2> template <class P2>
typename boost::enable_if<boost::is_constructible<value_type, P2&&>, typename boost::enable_if<std::is_constructible<value_type, P2&&>,
iterator>::type iterator>::type
insert(const_iterator hint, P2&& obj) insert(const_iterator hint, P2&& obj)
{ {
@ -942,8 +945,8 @@ namespace boost {
void swap(unordered_multimap&) void swap(unordered_multimap&)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::unordered::detail::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value); boost::unordered::detail::is_nothrow_swappable<P>::value);
void clear() noexcept { table_.clear_impl(); } void clear() noexcept { table_.clear_impl(); }
template <typename H2, typename P2> template <typename H2, typename P2>
@ -1135,8 +1138,8 @@ namespace boost {
Allocator>; Allocator>;
template <class Key, class T, template <class Key, class T,
class Hash = boost::hash<boost::remove_const_t<Key> >, class Hash = boost::hash<std::remove_const_t<Key> >,
class Pred = std::equal_to<boost::remove_const_t<Key> >, class Pred = std::equal_to<std::remove_const_t<Key> >,
class Allocator = std::allocator<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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_pred_v<Pred> >, class = boost::enable_if_t<detail::is_pred_v<Pred> >,
@ -1144,8 +1147,7 @@ namespace boost {
unordered_multimap(std::initializer_list<std::pair<Key, T> >, 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<boost::remove_const_t<Key>, T, Hash, Pred, -> unordered_multimap<std::remove_const_t<Key>, T, Hash, Pred, 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_input_iterator_v<InputIterator> >,
@ -1181,23 +1183,23 @@ namespace boost {
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_multimap(std::initializer_list<std::pair<Key, T> >, std::size_t, unordered_multimap(std::initializer_list<std::pair<Key, T> >, std::size_t,
Allocator) -> unordered_multimap<boost::remove_const_t<Key>, T, Allocator) -> unordered_multimap<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_multimap(std::initializer_list<std::pair<Key, T> >, Allocator) unordered_multimap(std::initializer_list<std::pair<Key, T> >, Allocator)
-> unordered_multimap<boost::remove_const_t<Key>, T, -> unordered_multimap<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Hash, class 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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_multimap(std::initializer_list<std::pair<Key, T> >, std::size_t, unordered_multimap(std::initializer_list<std::pair<Key, T> >, std::size_t,
Hash, Allocator) -> unordered_multimap<boost::remove_const_t<Key>, T, Hash, Allocator) -> unordered_multimap<std::remove_const_t<Key>, T, Hash,
Hash, std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
#endif #endif
@ -1428,8 +1430,8 @@ namespace boost {
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
void unordered_map<K, T, H, P, A>::swap(unordered_map& other) void unordered_map<K, T, H, P, A>::swap(unordered_map& other)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::unordered::detail::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value) boost::unordered::detail::is_nothrow_swappable<P>::value)
{ {
table_.swap(other.table_); table_.swap(other.table_);
} }
@ -1956,8 +1958,8 @@ namespace boost {
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
void unordered_multimap<K, T, H, P, A>::swap(unordered_multimap& other) void unordered_multimap<K, T, H, P, A>::swap(unordered_multimap& other)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::unordered::detail::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value) boost::unordered::detail::is_nothrow_swappable<P>::value)
{ {
table_.swap(other.table_); table_.swap(other.table_);
} }

View File

@ -99,9 +99,9 @@ namespace boost {
using init_type = typename map_types::init_type; using init_type = typename map_types::init_type;
using size_type = std::size_t; using size_type = std::size_t;
using difference_type = std::ptrdiff_t; using difference_type = std::ptrdiff_t;
using hasher = typename boost::type_identity<Hash>::type; using hasher = typename boost::unordered::detail::type_identity<Hash>::type;
using key_equal = typename boost::type_identity<KeyEqual>::type; using key_equal = typename boost::unordered::detail::type_identity<KeyEqual>::type;
using allocator_type = typename boost::type_identity<Allocator>::type; using allocator_type = typename boost::unordered::detail::type_identity<Allocator>::type;
using reference = value_type&; using reference = value_type&;
using const_reference = value_type const&; using const_reference = value_type const&;
using pointer = typename boost::allocator_pointer<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type;
@ -822,8 +822,8 @@ namespace boost {
Allocator>; Allocator>;
template <class Key, class T, template <class Key, class T,
class Hash = boost::hash<boost::remove_const_t<Key> >, class Hash = boost::hash<std::remove_const_t<Key> >,
class Pred = std::equal_to<boost::remove_const_t<Key> >, class Pred = std::equal_to<std::remove_const_t<Key> >,
class Allocator = std::allocator<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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_pred_v<Pred> >, class = boost::enable_if_t<detail::is_pred_v<Pred> >,
@ -831,7 +831,7 @@ namespace boost {
unordered_node_map(std::initializer_list<std::pair<Key, T> >, unordered_node_map(std::initializer_list<std::pair<Key, T> >,
std::size_t = boost::unordered::detail::foa::default_bucket_count, std::size_t = boost::unordered::detail::foa::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator()) Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_node_map<boost::remove_const_t<Key>, T, Hash, Pred, -> unordered_node_map<std::remove_const_t<Key>, T, Hash, Pred,
Allocator>; Allocator>;
template <class InputIterator, class Allocator, template <class InputIterator, class Allocator,
@ -868,23 +868,23 @@ namespace boost {
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_node_map(std::initializer_list<std::pair<Key, T> >, std::size_t, unordered_node_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Allocator) -> unordered_node_map<boost::remove_const_t<Key>, T, Allocator) -> unordered_node_map<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Allocator, template <class Key, class T, class Allocator,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_node_map(std::initializer_list<std::pair<Key, T> >, Allocator) unordered_node_map(std::initializer_list<std::pair<Key, T> >, Allocator)
-> unordered_node_map<boost::remove_const_t<Key>, T, -> unordered_node_map<std::remove_const_t<Key>, T,
boost::hash<boost::remove_const_t<Key> >, boost::hash<std::remove_const_t<Key> >,
std::equal_to<boost::remove_const_t<Key> >, Allocator>; std::equal_to<std::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Hash, class 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_hash_v<Hash> >,
class = boost::enable_if_t<detail::is_allocator_v<Allocator> > > class = boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_node_map(std::initializer_list<std::pair<Key, T> >, std::size_t, unordered_node_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Hash, Allocator) -> unordered_node_map<boost::remove_const_t<Key>, T, Hash, Allocator) -> unordered_node_map<std::remove_const_t<Key>, T,
Hash, std::equal_to<boost::remove_const_t<Key> >, Allocator>; Hash, std::equal_to<std::remove_const_t<Key> >, Allocator>;
#endif #endif
} // namespace unordered } // namespace unordered

View File

@ -145,8 +145,8 @@ namespace boost {
unordered_set& operator=(unordered_set&& x) unordered_set& operator=(unordered_set&& x)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& std::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) std::is_nothrow_move_assignable<P>::value)
{ {
table_.move_assign(x.table_, std::true_type()); table_.move_assign(x.table_, std::true_type());
return *this; return *this;
@ -303,8 +303,8 @@ namespace boost {
void swap(unordered_set&) void swap(unordered_set&)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::unordered::detail::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value); boost::unordered::detail::is_nothrow_swappable<P>::value);
void clear() noexcept { table_.clear_impl(); } void clear() noexcept { table_.clear_impl(); }
template <typename H2, typename P2> template <typename H2, typename P2>
@ -638,8 +638,8 @@ namespace boost {
unordered_multiset& operator=(unordered_multiset&& x) unordered_multiset& operator=(unordered_multiset&& x)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& std::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) std::is_nothrow_move_assignable<P>::value)
{ {
table_.move_assign(x.table_, std::false_type()); table_.move_assign(x.table_, std::false_type());
return *this; return *this;
@ -770,8 +770,8 @@ namespace boost {
void swap(unordered_multiset&) void swap(unordered_multiset&)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::unordered::detail::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value); boost::unordered::detail::is_nothrow_swappable<P>::value);
void clear() noexcept { table_.clear_impl(); } void clear() noexcept { table_.clear_impl(); }
template <typename H2, typename P2> template <typename H2, typename P2>
@ -1214,8 +1214,8 @@ namespace boost {
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
void unordered_set<T, H, P, A>::swap(unordered_set& other) void unordered_set<T, H, P, A>::swap(unordered_set& other)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::unordered::detail::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value) boost::unordered::detail::is_nothrow_swappable<P>::value)
{ {
table_.swap(other.table_); table_.swap(other.table_);
} }
@ -1611,8 +1611,8 @@ namespace boost {
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
void unordered_multiset<T, H, P, A>::swap(unordered_multiset& other) void unordered_multiset<T, H, P, A>::swap(unordered_multiset& other)
noexcept(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::unordered::detail::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value) boost::unordered::detail::is_nothrow_swappable<P>::value)
{ {
table_.swap(other.table_); table_.swap(other.table_);
} }

View File

@ -6,10 +6,15 @@
#if !defined(BOOST_UNORDERED_TEST_TEST_HEADER) #if !defined(BOOST_UNORDERED_TEST_TEST_HEADER)
#define BOOST_UNORDERED_TEST_TEST_HEADER #define BOOST_UNORDERED_TEST_TEST_HEADER
#include <boost/unordered/detail/fwd.hpp>
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/stringize.hpp> #include <boost/preprocessor/stringize.hpp>
#include <boost/unordered/detail/fwd.hpp>
#include <boost/type_traits/is_nothrow_move_assignable.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
#include <boost/type_traits/is_nothrow_swappable.hpp>
#include <boost/type_traits/make_void.hpp>
#define UNORDERED_AUTO_TEST(x) \ #define UNORDERED_AUTO_TEST(x) \
struct BOOST_PP_CAT(x, _type) : public ::test::registered_test_base \ struct BOOST_PP_CAT(x, _type) : public ::test::registered_test_base \
@ -120,7 +125,7 @@ namespace test {
static state instance; static state instance;
return instance; return instance;
} }
} } // namespace test
#if defined(__cplusplus) #if defined(__cplusplus)
#define BOOST_UNORDERED_CPLUSPLUS __cplusplus #define BOOST_UNORDERED_CPLUSPLUS __cplusplus
@ -184,7 +189,7 @@ namespace test {
#define UNORDERED_MULTI_TEST_OP2(name, n, params) \ #define UNORDERED_MULTI_TEST_OP2(name, n, params) \
{ \ { \
UNORDERED_SUB_TEST(BOOST_PP_STRINGIZE( \ UNORDERED_SUB_TEST(BOOST_PP_STRINGIZE( \
BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params))) \ BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params))) \
{ \ { \
for (int i = 0; i < n; ++i) \ for (int i = 0; i < n; ++i) \
name BOOST_PP_SEQ_TO_TUPLE(params); \ name BOOST_PP_SEQ_TO_TUPLE(params); \