Remove dependency on TypeTraits

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

View File

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

View File

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

View File

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

View File

@ -115,6 +115,7 @@ to normal separate chaining implementations.
#include <boost/unordered/detail/prime_fmod.hpp>
#include <boost/unordered/detail/serialize_tracked_address.hpp>
#include <boost/unordered/detail/opt_storage.hpp>
#include <boost/assert.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/serialization.hpp>
#include <boost/cstdint.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/config.hpp>
@ -143,19 +142,18 @@ namespace boost {
node>::type node_pointer;
node_pointer next;
typename boost::aligned_storage<sizeof(value_type),
boost::alignment_of<value_type>::value>::type buf;
opt_storage<value_type> buf;
node() noexcept : next(), buf() {}
value_type* value_ptr() noexcept
{
return reinterpret_cast<value_type*>(buf.address());
return buf.address();
}
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/cstdint.hpp>
#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/mulx.hpp>
#include <boost/unordered/detail/static_assert.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/unordered/hash_traits.hpp>
#include <climits>
#include <cmath>
@ -133,10 +130,10 @@
#define BOOST_UNORDERED_THREAD_SANITIZER
#endif
#define BOOST_UNORDERED_STATIC_ASSERT_HASH_PRED(Hash, Pred) \
static_assert(boost::is_nothrow_swappable<Hash>::value, \
"Template parameter Hash is required to be nothrow Swappable."); \
static_assert(boost::is_nothrow_swappable<Pred>::value, \
#define BOOST_UNORDERED_STATIC_ASSERT_HASH_PRED(Hash, Pred) \
static_assert(boost::unordered::detail::is_nothrow_swappable<Hash>::value, \
"Template parameter Hash is required to be nothrow Swappable."); \
static_assert(boost::unordered::detail::is_nothrow_swappable<Pred>::value, \
"Template parameter Pred is required to be nothrow Swappable");
namespace boost{
@ -1046,13 +1043,7 @@ struct table_arrays
initialize_groups(
arrays.groups(),groups_size,
std::integral_constant<
bool,
#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
bool,std::is_trivially_constructible<group_type>::value
>{});
arrays.groups()[groups_size-1].set_sentinel();
}

View File

@ -9,6 +9,8 @@
#ifndef 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/core/allocator_access.hpp>
@ -25,14 +27,6 @@ struct insert_return_type
NodeType node;
};
template <class T>
union opt_storage {
BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS T t_;
opt_storage(){}
~opt_storage(){}
};
template <class TypePolicy,class Allocator>
struct node_handle_base
{

View File

@ -16,6 +16,7 @@
#include <boost/unordered/detail/fca.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/static_assert.hpp>
#include <boost/unordered/detail/type_traits.hpp>
@ -31,20 +32,6 @@
#include <boost/mp11/algorithm.hpp>
#include <boost/mp11/list.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 <cmath>
@ -124,7 +111,7 @@ namespace boost {
// iterator SFINAE
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>
{
};
@ -292,8 +279,7 @@ namespace boost {
//////////////////////////////////////////////////////////////////////////
// Bits and pieces for implementing traits
template <typename T>
typename boost::add_lvalue_reference<T>::type make();
template <typename T> typename std::add_lvalue_reference<T>::type make();
struct choice9
{
typedef char (&type)[9];
@ -385,8 +371,7 @@ namespace boost {
{
typedef ValueType value_type;
typename boost::aligned_storage<sizeof(value_type),
boost::alignment_of<value_type>::value>::type data_;
opt_storage<value_type> data_;
value_base() : data_() {}
@ -865,26 +850,23 @@ namespace boost {
{
public:
static const bool nothrow_move_assignable =
boost::is_nothrow_move_assignable<H>::value &&
boost::is_nothrow_move_assignable<P>::value;
std::is_nothrow_move_assignable<H>::value &&
std::is_nothrow_move_assignable<P>::value;
static const bool nothrow_move_constructible =
boost::is_nothrow_move_constructible<H>::value &&
boost::is_nothrow_move_constructible<P>::value;
std::is_nothrow_move_constructible<H>::value &&
std::is_nothrow_move_constructible<P>::value;
static const bool nothrow_swappable =
boost::is_nothrow_swappable<H>::value &&
boost::is_nothrow_swappable<P>::value;
boost::unordered::detail::is_nothrow_swappable<H>::value &&
boost::unordered::detail::is_nothrow_swappable<P>::value;
private:
functions& operator=(functions const&);
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
// +2 - Both constructed
aligned_function funcs_[2];
opt_storage<function_pair> funcs_[2];
public:
functions(H const& hf, P const& eq) : current_(0)
@ -2138,8 +2120,8 @@ namespace boost {
void merge_unique(boost::unordered::detail::table<Types2>& other)
{
typedef boost::unordered::detail::table<Types2> other_table;
BOOST_UNORDERED_STATIC_ASSERT((
boost::is_same<node_type, typename other_table::node_type>::value));
BOOST_UNORDERED_STATIC_ASSERT(
(std::is_same<node_type, typename other_table::node_type>::value));
BOOST_ASSERT(this->node_alloc() == other.node_alloc());
if (other.size_ == 0) {
@ -2816,8 +2798,7 @@ namespace boost {
sizeof(choice2::type)
};
typedef
typename boost::conditional<value, Key const&, no_key>::type type;
typedef typename std::conditional<value, Key const&, no_key>::type type;
};
template <class ValueType> struct set_extractor
@ -2846,7 +2827,7 @@ namespace boost {
template <class ValueType> struct map_extractor
{
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;
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/config.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/make_unsigned.hpp>
#include <type_traits>
namespace boost{
namespace unordered{
@ -22,8 +21,8 @@ namespace detail{
template<typename To,typename From>
constexpr To narrow_cast(From x) noexcept
{
BOOST_UNORDERED_STATIC_ASSERT(boost::is_integral<From>::value);
BOOST_UNORDERED_STATIC_ASSERT(boost::is_integral<To>::value);
BOOST_UNORDERED_STATIC_ASSERT(std::is_integral<From>::value);
BOOST_UNORDERED_STATIC_ASSERT(std::is_integral<To>::value);
BOOST_UNORDERED_STATIC_ASSERT(sizeof(From)>=sizeof(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
* 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
);
}

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/serialization.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/bad_archive_exception.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>
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;
typedef typename boost::remove_const<
typedef typename std::remove_const<
typename Map::mapped_type>::type mapped_type;
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>
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;
typedef typename boost::remove_const<
typedef typename std::remove_const<
typename Map::mapped_type>::type mapped_type;
typedef typename Map::iterator iterator;
@ -195,7 +193,7 @@ void serialize_container(Archive& ar,Container& x,unsigned int version)
{
load_or_save_container<
Container,
boost::is_same<
std::is_same<
typename Container::key_type,typename Container::value_type>::value,
Archive::is_saving::value>()(ar,x,version);
}

View File

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

View File

@ -11,20 +11,13 @@
#pragma once
#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)
#include <boost/type_traits/enable_if.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <iterator>
#include <utility>
#endif
#include <type_traits>
#include <utility>
// BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
#if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES)
@ -40,19 +33,56 @@
namespace boost {
namespace unordered {
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
// and up
template <class, class = void>
struct is_transparent : public boost::false_type
struct is_transparent : public std::false_type
{
};
template <class T>
struct is_transparent<T,
typename boost::make_void<typename T::is_transparent>::type>
: public boost::true_type
typename boost::unordered::detail::make_void<typename T::is_transparent>::type>
: public std::true_type
{
};
@ -71,8 +101,8 @@ namespace boost {
static bool const value =
are_transparent<Key, hash, key_equal>::value &&
!boost::is_convertible<Key, iterator>::value &&
!boost::is_convertible<Key, const_iterator>::value;
!std::is_convertible<Key, iterator>::value &&
!std::is_convertible<Key, const_iterator>::value;
};
#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
@ -81,7 +111,7 @@ namespace boost {
template <class InputIterator>
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
{
@ -90,7 +120,7 @@ namespace boost {
template <class 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{}))> >
{
constexpr static bool const value = true;
@ -101,7 +131,7 @@ namespace boost {
template <class H>
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>;
@ -116,7 +146,7 @@ namespace boost {
typename std::pair<iter_key_t<T> const, iter_val_t<T> >;
#endif
} // namespace detail
} // namespace unordered
} // namespace unordered
} // namespace boost
#endif // BOOST_UNORDERED_DETAIL_TYPE_TRAITS_HPP

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,10 +6,15 @@
#if !defined(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/preprocessor/cat.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) \
struct BOOST_PP_CAT(x, _type) : public ::test::registered_test_base \
@ -120,7 +125,7 @@ namespace test {
static state instance;
return instance;
}
}
} // namespace test
#if defined(__cplusplus)
#define BOOST_UNORDERED_CPLUSPLUS __cplusplus
@ -184,7 +189,7 @@ namespace test {
#define UNORDERED_MULTI_TEST_OP2(name, n, params) \
{ \
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) \
name BOOST_PP_SEQ_TO_TUPLE(params); \