forked from boostorg/unordered
Unordered: Better emplace_args implementation.
And some misc. cleanup. [SVN r74750]
This commit is contained in:
@ -24,32 +24,40 @@
|
||||
#include <boost/type_traits/add_lvalue_reference.hpp>
|
||||
#include <boost/pointer_to_other.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
|
||||
# include <memory>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_TYPE_TRAITS)
|
||||
#include <type_traits>
|
||||
# include <type_traits>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Integral_constrant, true_type, false_type
|
||||
//
|
||||
// Uses the standard versions if available.
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_TYPE_TRAITS)
|
||||
|
||||
using std::integral_constant;
|
||||
using std::true_type;
|
||||
using std::false_type;
|
||||
}}}
|
||||
|
||||
#else
|
||||
namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <typename T, T Value>
|
||||
struct integral_constant { enum { value = Value }; };
|
||||
typedef integral_constant<bool, true> true_type;
|
||||
typedef integral_constant<bool, false> false_type;
|
||||
}}}
|
||||
|
||||
typedef boost::unordered::detail::integral_constant<bool, true> true_type;
|
||||
typedef boost::unordered::detail::integral_constant<bool, false> false_type;
|
||||
|
||||
#endif
|
||||
|
||||
// TODO: Use std::addressof if available?
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Explicitly call a destructor
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
@ -66,27 +74,10 @@ namespace boost { namespace unordered { namespace detail {
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
|
||||
template <typename Alloc>
|
||||
struct allocator_traits : std::allocator_traits<Alloc> {};
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
struct rebind_wrap
|
||||
{
|
||||
typedef typename allocator_traits<Alloc>::rebind_alloc<T> type;
|
||||
};
|
||||
#else
|
||||
// rebind_wrap
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Bits and pieces for implementing traits
|
||||
//
|
||||
// Rebind allocators. For some problematic libraries, use rebind_to
|
||||
// from <boost/detail/allocator_utilities.hpp>.
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
struct rebind_wrap
|
||||
{
|
||||
typedef typename Alloc::BOOST_NESTED_TEMPLATE rebind<T>::other
|
||||
type;
|
||||
};
|
||||
// Some of these are also used elsewhere
|
||||
|
||||
template <typename T> typename boost::add_lvalue_reference<T>::type make();
|
||||
struct choice9 { typedef char (&type)[9]; };
|
||||
@ -116,67 +107,6 @@ namespace boost { namespace unordered { namespace detail {
|
||||
convert_from_anything(...);
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1400
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \
|
||||
template <typename Tp, typename Default> \
|
||||
struct default_type_ ## tname { \
|
||||
\
|
||||
template <typename X> \
|
||||
static choice1::type test(choice1, typename X::tname* = 0); \
|
||||
\
|
||||
template <typename X> \
|
||||
static choice2::type test(choice2, void* = 0); \
|
||||
\
|
||||
struct DefaultWrap { typedef Default tname; }; \
|
||||
\
|
||||
enum { value = (1 == sizeof(test<Tp>(choose()))) }; \
|
||||
\
|
||||
typedef typename boost::detail::if_true<value>:: \
|
||||
BOOST_NESTED_TEMPLATE then<Tp, DefaultWrap> \
|
||||
::type::tname type; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <typename T, typename T2>
|
||||
struct sfinae : T2 {};
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \
|
||||
template <typename Tp, typename Default> \
|
||||
struct default_type_ ## tname { \
|
||||
\
|
||||
template <typename X> \
|
||||
static typename sfinae<typename X::tname, choice1>::type \
|
||||
test(choice1); \
|
||||
\
|
||||
template <typename X> \
|
||||
static choice2::type test(choice2); \
|
||||
\
|
||||
struct DefaultWrap { typedef Default tname; }; \
|
||||
\
|
||||
enum { value = (1 == sizeof(test<Tp>(choose()))) }; \
|
||||
\
|
||||
typedef typename boost::detail::if_true<value>:: \
|
||||
BOOST_NESTED_TEMPLATE then<Tp, DefaultWrap> \
|
||||
::type::tname type; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_TYPE(T,tname, arg) \
|
||||
typename default_type_ ## tname<T, arg>::type
|
||||
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(void_pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_void_pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(difference_type);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(size_type);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_swap);
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE_EXPR) || BOOST_WORKAROUND(BOOST_MSVC, >= 1500)
|
||||
|
||||
# define BOOST_UNORDERED_HAVE_CALL_0_DETECTION 1
|
||||
@ -188,9 +118,11 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
#define BOOST_UNORDERED_CHECK_EXPRESSION(count, result, expression) \
|
||||
template <typename U> \
|
||||
static typename expr_test< \
|
||||
static typename boost::unordered::detail::expr_test< \
|
||||
BOOST_PP_CAT(choice, result), \
|
||||
sizeof(for_expr_test(((expression), 0)))>::type test( \
|
||||
sizeof(boost::unordered::detail::for_expr_test(( \
|
||||
(expression), \
|
||||
0)))>::type test( \
|
||||
BOOST_PP_CAT(choice, count))
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_EXPRESSION(count, result) \
|
||||
@ -273,9 +205,10 @@ namespace boost { namespace unordered { namespace detail {
|
||||
template <typename U> \
|
||||
struct impl \
|
||||
{ \
|
||||
enum { value = sizeof(is_private_type(( \
|
||||
make<wrap< thing > >().name args \
|
||||
, 0))) == sizeof(yes_type) }; \
|
||||
enum { value = sizeof( \
|
||||
boost::unordered::detail::is_private_type(( \
|
||||
make<wrap< thing > >().name args \
|
||||
, 0))) == sizeof(yes_type) }; \
|
||||
}; \
|
||||
\
|
||||
enum { value = \
|
||||
@ -286,6 +219,95 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Allocator traits
|
||||
//
|
||||
// Uses the standard versions if available.
|
||||
// (although untested as I don't have access to a standard version yet)
|
||||
|
||||
#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
|
||||
|
||||
template <typename Alloc>
|
||||
struct allocator_traits : std::allocator_traits<Alloc> {};
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
struct rebind_wrap
|
||||
{
|
||||
typedef typename std::allocator_traits<Alloc>::rebind_alloc<T> type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// TODO: Does this match std::allocator_traits<Alloc>::rebind_alloc<T>?
|
||||
template <typename Alloc, typename T>
|
||||
struct rebind_wrap
|
||||
{
|
||||
typedef typename Alloc::BOOST_NESTED_TEMPLATE rebind<T>::other
|
||||
type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1400
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \
|
||||
template <typename Tp, typename Default> \
|
||||
struct default_type_ ## tname { \
|
||||
\
|
||||
template <typename X> \
|
||||
static choice1::type test(choice1, typename X::tname* = 0); \
|
||||
\
|
||||
template <typename X> \
|
||||
static choice2::type test(choice2, void* = 0); \
|
||||
\
|
||||
struct DefaultWrap { typedef Default tname; }; \
|
||||
\
|
||||
enum { value = (1 == sizeof(test<Tp>(choose()))) }; \
|
||||
\
|
||||
typedef typename boost::detail::if_true<value>:: \
|
||||
BOOST_NESTED_TEMPLATE then<Tp, DefaultWrap> \
|
||||
::type::tname type; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <typename T, typename T2>
|
||||
struct sfinae : T2 {};
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \
|
||||
template <typename Tp, typename Default> \
|
||||
struct default_type_ ## tname { \
|
||||
\
|
||||
template <typename X> \
|
||||
static typename boost::unordered::detail::sfinae< \
|
||||
typename X::tname, choice1>::type \
|
||||
test(choice1); \
|
||||
\
|
||||
template <typename X> \
|
||||
static choice2::type test(choice2); \
|
||||
\
|
||||
struct DefaultWrap { typedef Default tname; }; \
|
||||
\
|
||||
enum { value = (1 == sizeof(test<Tp>(choose()))) }; \
|
||||
\
|
||||
typedef typename boost::detail::if_true<value>:: \
|
||||
BOOST_NESTED_TEMPLATE then<Tp, DefaultWrap> \
|
||||
::type::tname type; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_TYPE(T,tname, arg) \
|
||||
typename default_type_ ## tname<T, arg>::type
|
||||
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(void_pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_void_pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(difference_type);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(size_type);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_swap);
|
||||
|
||||
#if BOOST_UNORDERED_HAVE_CALL_0_DETECTION
|
||||
template <typename T>
|
||||
BOOST_UNORDERED_HAS_FUNCTION(
|
||||
@ -425,7 +447,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
static void destroy(Alloc&, T* p, typename
|
||||
boost::disable_if<has_destroy<Alloc, T>, void*>::type = 0)
|
||||
{
|
||||
::boost::unordered::detail::destroy(p);
|
||||
boost::unordered::detail::destroy(p);
|
||||
}
|
||||
|
||||
static size_type max_size(const Alloc& a)
|
||||
@ -453,6 +475,10 @@ namespace boost { namespace unordered { namespace detail {
|
||||
Alloc,propagate_on_container_swap,false_type)
|
||||
propagate_on_container_swap;
|
||||
};
|
||||
|
||||
#undef BOOST_UNORDERED_DEFAULT_TYPE_TMPLT
|
||||
#undef BOOST_UNORDERED_DEFAULT_TYPE
|
||||
|
||||
#endif
|
||||
|
||||
// array_constructor
|
||||
@ -464,8 +490,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
template <typename Allocator>
|
||||
struct array_constructor
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::pointer
|
||||
pointer;
|
||||
typedef boost::unordered::detail::allocator_traits<Allocator> traits;
|
||||
typedef typename traits::pointer pointer;
|
||||
|
||||
Allocator& alloc_;
|
||||
pointer ptr_;
|
||||
@ -482,10 +508,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
~array_constructor() {
|
||||
if (ptr_) {
|
||||
for(pointer p = ptr_; p != constructed_; ++p)
|
||||
allocator_traits<Allocator>::destroy(alloc_,
|
||||
boost::addressof(*p));
|
||||
traits::destroy(alloc_, boost::addressof(*p));
|
||||
|
||||
allocator_traits<Allocator>::deallocate(alloc_, ptr_, length_);
|
||||
traits::deallocate(alloc_, ptr_, length_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,11 +519,10 @@ namespace boost { namespace unordered { namespace detail {
|
||||
{
|
||||
BOOST_ASSERT(!ptr_);
|
||||
length_ = l;
|
||||
ptr_ = allocator_traits<Allocator>::allocate(alloc_, length_);
|
||||
ptr_ = traits::allocate(alloc_, length_);
|
||||
pointer end = ptr_ + static_cast<std::ptrdiff_t>(length_);
|
||||
for(constructed_ = ptr_; constructed_ != end; ++constructed_)
|
||||
allocator_traits<Allocator>::construct(alloc_,
|
||||
boost::addressof(*constructed_), v);
|
||||
traits::construct(alloc_, boost::addressof(*constructed_), v);
|
||||
}
|
||||
|
||||
pointer get() const
|
||||
@ -514,25 +538,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
private:
|
||||
array_constructor(array_constructor const&);
|
||||
array_constructor& operator=(
|
||||
array_constructor const&);
|
||||
array_constructor& operator=(array_constructor const&);
|
||||
};
|
||||
}}}
|
||||
|
||||
#undef BOOST_UNORDERED_DEFAULT_TYPE_TMPLT
|
||||
#undef BOOST_UNORDERED_DEFAULT_TYPE
|
||||
#undef BOOST_UNORDERED_HAVE_CALL_0_DETECTION
|
||||
#undef BOOST_UNORDERED_HAVE_CALL_N_DETECTION
|
||||
#undef BOOST_UNORDERED_HAS_FUNCTION
|
||||
#if defined(BOOST_UNORDERED_CHECK_EXPRESSION)
|
||||
# undef BOOST_UNORDERED_CHECK_EXPRESSION
|
||||
# undef BOOST_UNORDERED_DEFAULT_EXPRESSION
|
||||
#endif
|
||||
#if defined(BOOST_UNORDERED_HAS_MEMBER)
|
||||
# undef BOOST_UNORDERED_HAS_MEMBER
|
||||
# undef BOOST_UNORDERED_CHECK_MEMBER
|
||||
# undef BOOST_UNORDERED_DEFAULT_MEMBER
|
||||
# undef BOOST_UNORDERED_WRAP_PARAMATERS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <boost/unordered/detail/emplace_args.hpp>
|
||||
#include <boost/type_traits/aligned_storage.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
@ -28,7 +29,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
template <typename Types> struct table;
|
||||
template <typename NodePointer> struct bucket;
|
||||
struct ptr_bucket;
|
||||
template <typename Allocator, typename Bucket, typename Node> struct buckets;
|
||||
template <typename A, typename Bucket, typename Node> struct buckets;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -40,7 +41,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
private:
|
||||
|
||||
typedef NodeAlloc node_allocator;
|
||||
typedef ::boost::unordered::detail::allocator_traits<NodeAlloc> node_allocator_traits;
|
||||
typedef boost::unordered::detail::allocator_traits<NodeAlloc>
|
||||
node_allocator_traits;
|
||||
typedef typename node_allocator_traits::value_type node;
|
||||
typedef typename node_allocator_traits::pointer node_pointer;
|
||||
typedef typename node::value_type value_type;
|
||||
@ -68,9 +70,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
void construct_value(BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
{
|
||||
BOOST_ASSERT(node_ && node_constructed_ && !value_constructed_);
|
||||
::boost::unordered::detail::construct_impl<value_type>(
|
||||
node_->value_ptr(),
|
||||
BOOST_UNORDERED_EMPLACE_FORWARD);
|
||||
boost::unordered::detail::construct_impl(
|
||||
node_->value_ptr(), BOOST_UNORDERED_EMPLACE_FORWARD);
|
||||
value_constructed_ = true;
|
||||
}
|
||||
|
||||
@ -78,7 +79,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
void construct_value2(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
BOOST_ASSERT(node_ && node_constructed_ && !value_constructed_);
|
||||
::boost::unordered::detail::construct_impl2<value_type>(
|
||||
boost::unordered::detail::construct_impl2(
|
||||
node_->value_ptr(), boost::forward<A0>(a0));
|
||||
value_constructed_ = true;
|
||||
}
|
||||
@ -106,11 +107,12 @@ namespace boost { namespace unordered { namespace detail {
|
||||
{
|
||||
if (node_) {
|
||||
if (value_constructed_) {
|
||||
::boost::unordered::detail::destroy(node_->value_ptr());
|
||||
boost::unordered::detail::destroy(node_->value_ptr());
|
||||
}
|
||||
|
||||
if (node_constructed_) {
|
||||
node_allocator_traits::destroy(alloc_, boost::addressof(*node_));
|
||||
node_allocator_traits::destroy(alloc_,
|
||||
boost::addressof(*node_));
|
||||
}
|
||||
|
||||
node_allocator_traits::deallocate(alloc_, node_, 1);
|
||||
@ -126,7 +128,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
node_ = node_allocator_traits::allocate(alloc_, 1);
|
||||
|
||||
node_allocator_traits::construct(alloc_, boost::addressof(*node_), node());
|
||||
node_allocator_traits::construct(alloc_,
|
||||
boost::addressof(*node_), node());
|
||||
node_->init(static_cast<typename node::link_pointer>(node_));
|
||||
node_constructed_ = true;
|
||||
}
|
||||
@ -135,7 +138,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
if (value_constructed_)
|
||||
{
|
||||
::boost::unordered::detail::destroy(node_->value_ptr());
|
||||
boost::unordered::detail::destroy(node_->value_ptr());
|
||||
value_constructed_ = false;
|
||||
}
|
||||
}
|
||||
@ -187,28 +190,38 @@ namespace boost { namespace unordered { namespace detail {
|
||||
buckets(buckets const&);
|
||||
buckets& operator=(buckets const&);
|
||||
public:
|
||||
typedef ::boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
typedef typename traits::void_pointer void_pointer;
|
||||
|
||||
typedef Node node;
|
||||
typedef Bucket bucket;
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<A, node>::type node_allocator;
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<A, bucket>::type bucket_allocator;
|
||||
typedef ::boost::unordered::detail::allocator_traits<node_allocator> node_allocator_traits;
|
||||
typedef ::boost::unordered::detail::allocator_traits<bucket_allocator> bucket_allocator_traits;
|
||||
typedef typename node_allocator_traits::pointer node_pointer;
|
||||
typedef typename node_allocator_traits::const_pointer const_node_pointer;
|
||||
typedef typename bucket_allocator_traits::pointer bucket_pointer;
|
||||
typedef typename bucket::previous_pointer previous_pointer;
|
||||
typedef ::boost::unordered::detail::node_constructor<node_allocator> node_constructor;
|
||||
typedef typename boost::unordered::detail::rebind_wrap<A, node>::type
|
||||
node_allocator;
|
||||
typedef typename boost::unordered::detail::rebind_wrap<A, bucket>::type
|
||||
bucket_allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<node_allocator>
|
||||
node_allocator_traits;
|
||||
typedef boost::unordered::detail::allocator_traits<bucket_allocator>
|
||||
bucket_allocator_traits;
|
||||
typedef typename node_allocator_traits::pointer
|
||||
node_pointer;
|
||||
typedef typename node_allocator_traits::const_pointer
|
||||
const_node_pointer;
|
||||
typedef typename bucket_allocator_traits::pointer
|
||||
bucket_pointer;
|
||||
typedef typename bucket::previous_pointer
|
||||
previous_pointer;
|
||||
typedef boost::unordered::detail::node_constructor<node_allocator>
|
||||
node_constructor;
|
||||
|
||||
// Members
|
||||
|
||||
bucket_pointer buckets_;
|
||||
std::size_t bucket_count_;
|
||||
std::size_t size_;
|
||||
::boost::unordered::detail::compressed<bucket_allocator, node_allocator> allocators_;
|
||||
boost::unordered::detail::compressed<bucket_allocator, node_allocator>
|
||||
allocators_;
|
||||
|
||||
// Data access
|
||||
|
||||
@ -235,7 +248,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
std::size_t max_bucket_count() const
|
||||
{
|
||||
// -1 to account for the start bucket.
|
||||
return prev_prime(bucket_allocator_traits::max_size(bucket_alloc()) - 1);
|
||||
return boost::unordered::detail::prev_prime(
|
||||
bucket_allocator_traits::max_size(bucket_alloc()) - 1);
|
||||
}
|
||||
|
||||
bucket_pointer get_bucket(std::size_t bucket_index) const
|
||||
@ -261,7 +275,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
node_pointer get_start(std::size_t bucket_index) const
|
||||
{
|
||||
previous_pointer prev = this->get_previous_start(bucket_index);
|
||||
return prev ? static_cast<node_pointer>(prev->next_) : node_pointer();
|
||||
return prev ? static_cast<node_pointer>(prev->next_) :
|
||||
node_pointer();
|
||||
}
|
||||
|
||||
float load_factor() const
|
||||
@ -298,7 +313,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
{
|
||||
}
|
||||
|
||||
buckets(buckets& b, ::boost::unordered::detail::move_tag m) :
|
||||
buckets(buckets& b, boost::unordered::detail::move_tag m) :
|
||||
buckets_(),
|
||||
bucket_count_(b.bucket_count_),
|
||||
size_(),
|
||||
@ -308,8 +323,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
|
||||
template <typename Types>
|
||||
buckets(::boost::unordered::detail::table<Types>& x,
|
||||
::boost::unordered::detail::move_tag m) :
|
||||
buckets(boost::unordered::detail::table<Types>& x,
|
||||
boost::unordered::detail::move_tag m) :
|
||||
buckets_(),
|
||||
bucket_count_(x.bucket_count_),
|
||||
size_(),
|
||||
@ -324,7 +339,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
void create_buckets()
|
||||
{
|
||||
::boost::unordered::detail::array_constructor<bucket_allocator>
|
||||
boost::unordered::detail::array_constructor<bucket_allocator>
|
||||
constructor(bucket_alloc());
|
||||
|
||||
// Creates an extra bucket to act as the start node.
|
||||
@ -335,8 +350,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
node_constructor a(this->node_alloc());
|
||||
a.construct_node();
|
||||
|
||||
(constructor.get() + static_cast<std::ptrdiff_t>(this->bucket_count_))->next_ =
|
||||
a.release();
|
||||
(constructor.get() +
|
||||
static_cast<std::ptrdiff_t>(this->bucket_count_))->next_ =
|
||||
a.release();
|
||||
}
|
||||
|
||||
this->buckets_ = constructor.release();
|
||||
@ -348,17 +364,17 @@ namespace boost { namespace unordered { namespace detail {
|
||||
void swap(buckets& other, false_type = false_type())
|
||||
{
|
||||
BOOST_ASSERT(node_alloc() == other.node_alloc());
|
||||
std::swap(buckets_, other.buckets_);
|
||||
std::swap(bucket_count_, other.bucket_count_);
|
||||
std::swap(size_, other.size_);
|
||||
boost::swap(buckets_, other.buckets_);
|
||||
boost::swap(bucket_count_, other.bucket_count_);
|
||||
boost::swap(size_, other.size_);
|
||||
}
|
||||
|
||||
void swap(buckets& other, true_type)
|
||||
{
|
||||
allocators_.swap(other.allocators_);
|
||||
std::swap(buckets_, other.buckets_);
|
||||
std::swap(bucket_count_, other.bucket_count_);
|
||||
std::swap(size_, other.size_);
|
||||
boost::swap(buckets_, other.buckets_);
|
||||
boost::swap(bucket_count_, other.bucket_count_);
|
||||
boost::swap(size_, other.size_);
|
||||
}
|
||||
|
||||
void move_buckets_from(buckets& other)
|
||||
@ -378,7 +394,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
inline void delete_node(node_pointer n)
|
||||
{
|
||||
::boost::unordered::detail::destroy(n->value_ptr());
|
||||
boost::unordered::detail::destroy(n->value_ptr());
|
||||
node_allocator_traits::destroy(node_alloc(), boost::addressof(*n));
|
||||
node_allocator_traits::deallocate(node_alloc(), n, 1);
|
||||
--size_;
|
||||
@ -426,10 +442,12 @@ namespace boost { namespace unordered { namespace detail {
|
||||
bucket_pointer end = this->get_bucket(this->bucket_count_ + 1);
|
||||
for(bucket_pointer it = this->buckets_; it != end; ++it)
|
||||
{
|
||||
bucket_allocator_traits::destroy(bucket_alloc(), boost::addressof(*it));
|
||||
bucket_allocator_traits::destroy(bucket_alloc(),
|
||||
boost::addressof(*it));
|
||||
}
|
||||
|
||||
bucket_allocator_traits::deallocate(bucket_alloc(), this->buckets_, this->bucket_count_ + 1);
|
||||
bucket_allocator_traits::deallocate(bucket_alloc(),
|
||||
this->buckets_, this->bucket_count_ + 1);
|
||||
|
||||
this->buckets_ = bucket_pointer();
|
||||
}
|
||||
@ -460,7 +478,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
// This is called after erasing a node or group of nodes to fix up
|
||||
// the bucket pointers.
|
||||
void fix_buckets(bucket_pointer bucket, previous_pointer prev, node_pointer next)
|
||||
void fix_buckets(bucket_pointer bucket,
|
||||
previous_pointer prev, node_pointer next)
|
||||
{
|
||||
if (!next)
|
||||
{
|
||||
@ -481,8 +500,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
// This is called after erasing a range of nodes to fix any bucket
|
||||
// pointers into that range.
|
||||
void fix_buckets_range(
|
||||
std::size_t bucket_index, previous_pointer prev, node_pointer begin, node_pointer end)
|
||||
void fix_buckets_range(std::size_t bucket_index,
|
||||
previous_pointer prev, node_pointer begin, node_pointer end)
|
||||
{
|
||||
node_pointer n = begin;
|
||||
|
||||
@ -550,9 +569,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
typedef compressed<H, P> function_pair;
|
||||
|
||||
typedef typename ::boost::aligned_storage<
|
||||
typedef typename boost::aligned_storage<
|
||||
sizeof(function_pair),
|
||||
::boost::alignment_of<function_pair>::value>::type aligned_function;
|
||||
boost::alignment_of<function_pair>::value>::type aligned_function;
|
||||
|
||||
bool current_; // The currently active functions.
|
||||
aligned_function funcs_[2];
|
||||
@ -574,7 +593,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
void destroy(bool which)
|
||||
{
|
||||
::boost::unordered::detail::destroy((function_pair*)(&funcs_[which]));
|
||||
boost::unordered::detail::destroy((function_pair*)(&funcs_[which]));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -592,7 +611,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
|
||||
~functions() {
|
||||
destroy(current_);
|
||||
this->destroy(current_);
|
||||
}
|
||||
|
||||
H const& hash_function() const {
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#define BOOST_UNORDERED_EMPLACE_LIMIT 10
|
||||
|
||||
#if 0 && !defined(BOOST_NO_RVALUE_REFERENCES) && \
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES) && \
|
||||
!defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
|
||||
@ -54,13 +54,17 @@
|
||||
# elif defined(__IBMCPP__)
|
||||
# elif defined(MSIPL_COMPILE_H)
|
||||
# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
|
||||
// Visual C++. A version check would be a good idea.
|
||||
# define BOOST_UNORDERED_STD_FORWARD_MOVE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// emplace_args
|
||||
//
|
||||
// Either forwarding variadic arguments, or storing the arguments in
|
||||
// emplace_args##n
|
||||
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
|
||||
#define BOOST_UNORDERED_EMPLACE_TEMPLATE typename... Args
|
||||
@ -162,12 +166,13 @@ BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, BOOST_UNORDERED_EARGS,
|
||||
{};
|
||||
|
||||
# define BOOST_UNORDERED_RV_REF(T) \
|
||||
typename ::boost::unordered::detail::rv_ref<T>::type
|
||||
typename boost::unordered::detail::rv_ref<T>::type
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Construct from tuple
|
||||
//
|
||||
// Value Construction
|
||||
// Used for piecewise construction.
|
||||
|
||||
#define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \
|
||||
template<typename T> \
|
||||
@ -204,6 +209,16 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1)
|
||||
#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL
|
||||
#undef BOOST_UNORDERED_GET_TUPLE_ARG
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// SFINAE traits for construction.
|
||||
|
||||
// Decide which construction method to use for a three argument
|
||||
// call. Note that this is difficult to do using overloads because
|
||||
// the arguments are packed into 'emplace_args3'.
|
||||
//
|
||||
// The decision is made on the first argument.
|
||||
|
||||
|
||||
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
|
||||
template <typename A, typename B, typename A0>
|
||||
struct emulation1 {
|
||||
@ -216,328 +231,185 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1)
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename A, typename B, typename A0>
|
||||
struct check3_base {
|
||||
static choice1::type check(choice1,
|
||||
boost::unordered::piecewise_construct_t);
|
||||
|
||||
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
|
||||
template <typename A, typename B, typename A0>
|
||||
struct check3_base {
|
||||
static choice1::type check(choice1,
|
||||
boost::unordered::piecewise_construct_t);
|
||||
static choice2::type check(choice2, A const&);
|
||||
static choice3::type check(choice3, ...);
|
||||
};
|
||||
#else
|
||||
template <typename A, typename B, typename A0>
|
||||
struct check3_base {
|
||||
static choice1::type check(choice1,
|
||||
boost::unordered::piecewise_construct_t);
|
||||
static choice3::type check(choice3, ...);
|
||||
};
|
||||
#endif
|
||||
|
||||
static choice3::type check(choice3, ...);
|
||||
|
||||
enum { value = sizeof(check(choose(), make<A0>())) };
|
||||
};
|
||||
|
||||
template <typename A, typename B, typename A0>
|
||||
struct piecewise3 {
|
||||
enum { value =
|
||||
sizeof(check3_base<A,B,A0>::check(choose(), make<A0>())) ==
|
||||
sizeof(choice1::type) };
|
||||
enum { value = check3_base<A,B,A0>::value == sizeof(choice1::type) };
|
||||
};
|
||||
|
||||
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
|
||||
template <typename A, typename B, typename A0>
|
||||
struct emulation3 {
|
||||
enum { value =
|
||||
sizeof(check3_base<A,B,A0>::check(choose(), make<A0>())) ==
|
||||
sizeof(choice2::type) };
|
||||
enum { value = check3_base<A,B,A0>::value == sizeof(choice2::type) };
|
||||
};
|
||||
|
||||
template <typename A, typename B, typename A0>
|
||||
struct normal3 {
|
||||
enum { value =
|
||||
sizeof(check3_base<A,B,A0>::check(choose(), make<A0>())) ==
|
||||
sizeof(choice3::type) };
|
||||
};
|
||||
|
||||
template <typename T, typename A0>
|
||||
struct pair_construct1 {};
|
||||
template <typename T, typename A0>
|
||||
struct normal_construct1 { typedef void type; };
|
||||
|
||||
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
|
||||
template <typename A, typename B, typename A0>
|
||||
struct pair_construct1<std::pair<A, B>, A0>
|
||||
: enable_if<emulation1<A, B, A0>, void> {};
|
||||
|
||||
template <typename A, typename B, typename A0>
|
||||
struct normal_construct1<std::pair<A, B>, A0>
|
||||
: disable_if<emulation1<A, B, A0>, void> {};
|
||||
#endif
|
||||
|
||||
template <typename T, typename A0>
|
||||
struct piecewise_construct3 {};
|
||||
template <typename A, typename B, typename A0>
|
||||
struct piecewise_construct3<std::pair<A, B>, A0>
|
||||
: enable_if<piecewise3<A, B, A0>, void> {};
|
||||
|
||||
template <typename T, typename A0>
|
||||
struct pair_construct3 {};
|
||||
template <typename A, typename B, typename A0>
|
||||
struct pair_construct3<std::pair<A, B>, A0>
|
||||
: enable_if<emulation3<A, B, A0>, void> {};
|
||||
|
||||
template <typename T, typename A0>
|
||||
struct normal_construct3 { typedef void type; };
|
||||
template <typename A, typename B, typename A0>
|
||||
struct normal_construct3<std::pair<A, B>, A0>
|
||||
: enable_if<normal3<A, B, A0>, void> {};
|
||||
|
||||
template <typename T>
|
||||
struct pair_construct_n {};
|
||||
template <typename T>
|
||||
struct normal_construct_n { typedef void type; };
|
||||
|
||||
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
|
||||
template <typename A, typename B>
|
||||
struct pair_construct_n<std::pair<A, B> > { typedef void type; };
|
||||
template <typename A, typename B>
|
||||
struct normal_construct_n<std::pair<A, B> > {};
|
||||
#endif
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline typename normal_construct1<T, A0>::type
|
||||
construct_impl2(void* address, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
new(address) T(
|
||||
boost::forward<A0>(a0)
|
||||
);
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Construct from variadic parameters
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Construct from variadic parameters
|
||||
|
||||
template <typename T>
|
||||
inline void construct_impl(void* address)
|
||||
template <typename T, typename... Args>
|
||||
inline void construct_impl(T* address, Args&&... args)
|
||||
{
|
||||
new(address) T();
|
||||
new((void*) address) T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline typename normal_construct1<T, A0>::type
|
||||
construct_impl(void* address, A0&& a0)
|
||||
template <typename A, typename B, typename A0, typename A1, typename A2>
|
||||
inline typename enable_if<piecewise3<A, B, A0>, void>::type
|
||||
construct_impl(std::pair<A, B>* address, A0&&, A1&& a1, A2&& a2)
|
||||
{
|
||||
new(address) T(
|
||||
boost::forward<A0>(a0)
|
||||
);
|
||||
construct_from_tuple(
|
||||
boost::addressof(address->first), a1);
|
||||
construct_from_tuple(
|
||||
boost::addressof(address->second), a2);
|
||||
}
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline typename pair_construct1<T, A0>::type
|
||||
construct_impl(void* address, A0&& a0)
|
||||
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
|
||||
|
||||
template <typename A, typename B, typename A0>
|
||||
inline typename enable_if<emulation1<A, B, A0>, void>::type
|
||||
construct_impl(std::pair<A, B>* address, A0&& a0)
|
||||
{
|
||||
new((void*)(&static_cast<T*>(address)->first))
|
||||
typename T::first_type(
|
||||
boost::forward<A0>(a0));
|
||||
new((void*)(&static_cast<T*>(address)->second))
|
||||
typename T::second_type();
|
||||
new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
|
||||
new((void*) boost::addressof(address->second)) B();
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1>
|
||||
inline void construct_impl(void* address, A0&& a0, A1&& a1)
|
||||
template <typename A, typename B, typename A0, typename A1, typename A2>
|
||||
inline typename enable_if<emulation3<A, B, A0>, void>::type
|
||||
construct_impl(T* address, A0&& a0, A1&& a1, A2&& a2)
|
||||
{
|
||||
new(address) T(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1));
|
||||
new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
|
||||
new((void*) boost::addressof(address->second)) B(
|
||||
std::forward<A1>(a1),
|
||||
std::forward<A2>(a2));
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2>
|
||||
inline typename piecewise_construct3<T, A0>::type
|
||||
construct_impl(void* address, A0&&, A1&& a1, A2&& a2)
|
||||
{
|
||||
construct_from_tuple(
|
||||
boost::addressof(static_cast<T*>(address)->first), a1);
|
||||
construct_from_tuple(
|
||||
boost::addressof(static_cast<T*>(address)->second), a2);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2>
|
||||
inline typename pair_construct3<T, A0>::type
|
||||
construct_impl(void* address, A0&& a0, A1&& a1, A2&& a2)
|
||||
{
|
||||
new((void*)(&static_cast<T*>(address)->first))
|
||||
typename T::first_type(
|
||||
boost::forward<A0>(a0));
|
||||
new((void*)(&static_cast<T*>(address)->second))
|
||||
typename T::second_type(
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2));
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2>
|
||||
inline typename normal_construct3<T, A0>::type
|
||||
construct_impl(void* address, A0&& a0, A1&& a1, A2&& a2)
|
||||
{
|
||||
new(address) T(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2));
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2, typename A3,
|
||||
template <typename A, typename B,
|
||||
typename A0, typename A1, typename A2, typename A3,
|
||||
typename... Args>
|
||||
inline typename normal_construct_n<T>::type
|
||||
construct_impl(void* address, A0&& a0, A1&& a1, A2&& a2,
|
||||
A3&& a3, Args&&... args)
|
||||
inline void construct_impl(std::pair<A, B>* address,
|
||||
A0&& a0, A1&& a1, A2&& a2, A3&& a3, Args&&... args)
|
||||
{
|
||||
new(address) T(
|
||||
std::forward<A0>(a0),
|
||||
new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
|
||||
|
||||
new((void*) boost::addressof(address->second)) B(
|
||||
std::forward<A1>(a1),
|
||||
std::forward<A2>(a2),
|
||||
std::forward<A3>(a3),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2, typename A3,
|
||||
typename... Args>
|
||||
inline typename pair_construct_n<T>::type
|
||||
construct_impl(void* address, A0&& a0, A1&& a1, A2&& a2,
|
||||
A3&& a3, Args&&... args)
|
||||
{
|
||||
new((void*)(&static_cast<T*>(address)->first))
|
||||
typename T::first_type(
|
||||
std::forward<A0>(a0));
|
||||
new((void*)(&static_cast<T*>(address)->second))
|
||||
typename T::second_type(
|
||||
std::forward<A1>(a1),
|
||||
std::forward<A2>(a2),
|
||||
std::forward<A3>(a3),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else
|
||||
#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
|
||||
#else // BOOST_UNORDERED_STD_FORWARD_MOVE
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Construct with emplace_args
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline typename normal_construct1<T, A0>::type
|
||||
construct_impl(void* address,
|
||||
::boost::unordered::detail::emplace_args1<A0> const& args)
|
||||
{
|
||||
new(address) T(
|
||||
boost::forward<A0>(args.a0)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline typename pair_construct1<T, A0>::type
|
||||
construct_impl(void* address, A0 const& a0)
|
||||
{
|
||||
new((void*)(&static_cast<T*>(address)->first))
|
||||
typename T::first_type(
|
||||
boost::forward<A0>(a0));
|
||||
new((void*)(&static_cast<T*>(address)->second))
|
||||
typename T::second_type();
|
||||
}
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline typename pair_construct1<T, A0>::type
|
||||
construct_impl(void* address,
|
||||
::boost::unordered::detail::emplace_args1<A0> const& args)
|
||||
{
|
||||
new((void*)(&static_cast<T*>(address)->first))
|
||||
typename T::first_type(
|
||||
boost::forward<A0>(args.a0));
|
||||
new((void*)(&static_cast<T*>(address)->second))
|
||||
typename T::second_type();
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1>
|
||||
inline void construct_impl(void* address,
|
||||
::boost::unordered::detail::emplace_args2<A0, A1> const& args)
|
||||
{
|
||||
new(address) T(
|
||||
boost::forward<A0>(args.a0),
|
||||
boost::forward<A1>(args.a1));
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2>
|
||||
inline typename piecewise_construct3<T, A0>::type
|
||||
construct_impl(void* address,
|
||||
::boost::unordered::detail::emplace_args3<A0, A1, A2> const& args)
|
||||
{
|
||||
construct_from_tuple(
|
||||
boost::addressof(static_cast<T*>(address)->first), args.a1);
|
||||
construct_from_tuple(
|
||||
boost::addressof(static_cast<T*>(address)->second), args.a2);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2>
|
||||
inline typename pair_construct3<T, A0>::type
|
||||
construct_impl(void* address,
|
||||
::boost::unordered::detail::emplace_args3<A0, A1, A2> const& args)
|
||||
{
|
||||
new((void*)(&static_cast<T*>(address)->first))
|
||||
typename T::first_type(
|
||||
boost::forward<A0>(args.a0));
|
||||
new((void*)(&static_cast<T*>(address)->second))
|
||||
typename T::second_type(
|
||||
boost::forward<A1>(args.a1),
|
||||
boost::forward<A2>(args.a2));
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2>
|
||||
inline typename normal_construct3<T, A0>::type
|
||||
construct_impl(void* address,
|
||||
::boost::unordered::detail::emplace_args3<A0, A1, A2> const& args)
|
||||
{
|
||||
new(address) T(
|
||||
boost::forward<A0>(args.a0),
|
||||
boost::forward<A1>(args.a1),
|
||||
boost::forward<A2>(args.a2));
|
||||
}
|
||||
// Construct from emplace_args
|
||||
|
||||
#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \
|
||||
template < \
|
||||
typename T, \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \
|
||||
> \
|
||||
inline typename normal_construct_n<T>::type \
|
||||
construct_impl(void* address, \
|
||||
::boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \
|
||||
inline void construct_impl(T* address, \
|
||||
boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \
|
||||
> const& args) \
|
||||
{ \
|
||||
new(address) T( \
|
||||
new((void*) address) T( \
|
||||
BOOST_PP_ENUM_##z(num_params, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
args.a)); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_UNORDERED_CONSTRUCT_IMPL, _)
|
||||
|
||||
#undef BOOST_UNORDERED_CONSTRUCT_IMPL
|
||||
|
||||
template <typename A, typename B, typename A0, typename A1, typename A2>
|
||||
inline typename enable_if<piecewise3<A, B, A0>, void>::type
|
||||
construct_impl(std::pair<A, B>* address,
|
||||
boost::unordered::detail::emplace_args3<A0, A1, A2> const& args)
|
||||
{
|
||||
construct_from_tuple(
|
||||
boost::addressof(address->first), args.a1);
|
||||
construct_from_tuple(
|
||||
boost::addressof(address->second), args.a2);
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
|
||||
|
||||
template <typename A, typename B, typename A0>
|
||||
inline typename enable_if<emulation1<A, B, A0>, void>::type
|
||||
construct_impl(std::pair<A, B>* address,
|
||||
boost::unordered::detail::emplace_args1<A0> const& args)
|
||||
{
|
||||
new((void*) boost::addressof(address->first)) A(
|
||||
boost::forward<A0>(args.a0));
|
||||
new((void*) boost::addressof(address->second)) B();
|
||||
}
|
||||
|
||||
template <typename A, typename B, typename A0, typename A1, typename A2>
|
||||
inline typename enable_if<emulation3<A, B, A0>, void>::type
|
||||
construct_impl(std::pair<A, B>* address,
|
||||
boost::unordered::detail::emplace_args3<A0, A1, A2> const& args)
|
||||
{
|
||||
new((void*) boost::addressof(address->first)) A(
|
||||
boost::forward<A0>(args.a0));
|
||||
new((void*) boost::addressof(address->second)) B(
|
||||
boost::forward<A1>(args.a1),
|
||||
boost::forward<A2>(args.a2));
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(z, num_params, _) \
|
||||
template <typename T, \
|
||||
template <typename A, typename B, \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \
|
||||
> \
|
||||
inline typename pair_construct_n<T>::type \
|
||||
construct_impl(void* address, \
|
||||
::boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \
|
||||
inline void construct_impl(std::pair<A, B>* address, \
|
||||
boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \
|
||||
> const& args) \
|
||||
{ \
|
||||
new((void*)(&static_cast<T*>(address)->first)) \
|
||||
typename T::first_type( \
|
||||
new((void*) boost::addressof(address->first)) A( \
|
||||
boost::forward<A0>(args.a0)); \
|
||||
new((void*)(&static_cast<T*>(address)->second)) \
|
||||
typename T::second_type( \
|
||||
new((void*) boost::addressof(address->second)) B( \
|
||||
BOOST_PP_ENUM_SHIFTED_##z(num_params, \
|
||||
BOOST_UNORDERED_CALL_FORWARD, args.a)); \
|
||||
}
|
||||
|
||||
BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(1, 2, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL, _)
|
||||
|
||||
#undef BOOST_UNORDERED_CONSTRUCT_IMPL
|
||||
#undef BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL
|
||||
#endif
|
||||
|
||||
#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
|
||||
#endif // BOOST_UNORDERED_STD_FORWARD_MOVE
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Construct without using the emplace args mechanism.
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline void construct_impl2(T* address, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
new((void*) address) T(
|
||||
boost::forward<A0>(a0)
|
||||
);
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <typename VoidPointer, typename T>
|
||||
struct grouped_node :
|
||||
::boost::unordered::detail::value_base<T>
|
||||
boost::unordered::detail::value_base<T>
|
||||
{
|
||||
typedef VoidPointer link_pointer;
|
||||
|
||||
@ -45,10 +45,10 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <typename T>
|
||||
struct grouped_ptr_node :
|
||||
::boost::unordered::detail::value_base<T>,
|
||||
::boost::unordered::detail::ptr_bucket
|
||||
boost::unordered::detail::value_base<T>,
|
||||
boost::unordered::detail::ptr_bucket
|
||||
{
|
||||
typedef ::boost::unordered::detail::ptr_bucket bucket_base;
|
||||
typedef boost::unordered::detail::ptr_bucket bucket_base;
|
||||
typedef ptr_bucket* link_pointer;
|
||||
|
||||
link_pointer group_prev_;
|
||||
@ -72,37 +72,37 @@ namespace boost { namespace unordered { namespace detail {
|
||||
template <typename A, typename T, typename VoidPointer, typename NodePtr, typename BucketPtr>
|
||||
struct pick_grouped_node2
|
||||
{
|
||||
typedef ::boost::unordered::detail::grouped_node<VoidPointer, T> node;
|
||||
typedef boost::unordered::detail::grouped_node<VoidPointer, T> node;
|
||||
|
||||
typedef typename ::boost::unordered::detail::allocator_traits<
|
||||
typename ::boost::unordered::detail::rebind_wrap<A, node>::type
|
||||
typedef typename boost::unordered::detail::allocator_traits<
|
||||
typename boost::unordered::detail::rebind_wrap<A, node>::type
|
||||
>::pointer node_pointer;
|
||||
|
||||
typedef ::boost::unordered::detail::bucket<node_pointer> bucket;
|
||||
typedef boost::unordered::detail::bucket<node_pointer> bucket;
|
||||
typedef VoidPointer link_pointer;
|
||||
};
|
||||
|
||||
template <typename A, typename T>
|
||||
struct pick_grouped_node2<A, T, void*,
|
||||
::boost::unordered::detail::grouped_ptr_node<T>*,
|
||||
::boost::unordered::detail::ptr_bucket*>
|
||||
boost::unordered::detail::grouped_ptr_node<T>*,
|
||||
boost::unordered::detail::ptr_bucket*>
|
||||
{
|
||||
typedef ::boost::unordered::detail::grouped_ptr_node<T> node;
|
||||
typedef ::boost::unordered::detail::ptr_bucket bucket;
|
||||
typedef boost::unordered::detail::grouped_ptr_node<T> node;
|
||||
typedef boost::unordered::detail::ptr_bucket bucket;
|
||||
typedef bucket* link_pointer;
|
||||
};
|
||||
|
||||
template <typename A, typename T>
|
||||
struct pick_grouped_node
|
||||
{
|
||||
typedef ::boost::unordered::detail::allocator_traits<
|
||||
typename ::boost::unordered::detail::rebind_wrap<A,
|
||||
::boost::unordered::detail::grouped_ptr_node<T> >::type
|
||||
typedef boost::unordered::detail::allocator_traits<
|
||||
typename boost::unordered::detail::rebind_wrap<A,
|
||||
boost::unordered::detail::grouped_ptr_node<T> >::type
|
||||
> tentative_node_traits;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<
|
||||
typename ::boost::unordered::detail::rebind_wrap<A,
|
||||
::boost::unordered::detail::ptr_bucket >::type
|
||||
typedef boost::unordered::detail::allocator_traits<
|
||||
typename boost::unordered::detail::rebind_wrap<A,
|
||||
boost::unordered::detail::ptr_bucket >::type
|
||||
> tentative_bucket_traits;
|
||||
|
||||
typedef pick_grouped_node2<A, T,
|
||||
@ -124,17 +124,17 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef H hasher;
|
||||
typedef P key_equal;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
typedef typename traits::void_pointer void_pointer;
|
||||
typedef value_type key_type;
|
||||
|
||||
typedef typename ::boost::unordered::detail::pick_grouped_node<A, value_type>::node node;
|
||||
typedef typename ::boost::unordered::detail::pick_grouped_node<A, value_type>::bucket bucket;
|
||||
typedef typename ::boost::unordered::detail::pick_grouped_node<A, value_type>::link_pointer link_pointer;
|
||||
typedef ::boost::unordered::detail::grouped_table_impl<types> table;
|
||||
typedef typename boost::unordered::detail::pick_grouped_node<A, value_type>::node node;
|
||||
typedef typename boost::unordered::detail::pick_grouped_node<A, value_type>::bucket bucket;
|
||||
typedef typename boost::unordered::detail::pick_grouped_node<A, value_type>::link_pointer link_pointer;
|
||||
typedef boost::unordered::detail::grouped_table_impl<types> table;
|
||||
|
||||
typedef ::boost::unordered::detail::set_extractor<value_type> extractor;
|
||||
typedef boost::unordered::detail::set_extractor<value_type> extractor;
|
||||
};
|
||||
|
||||
template <typename A, typename K, typename H, typename P>
|
||||
@ -147,22 +147,22 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef P key_equal;
|
||||
typedef K key_type;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
typedef typename traits::void_pointer void_pointer;
|
||||
|
||||
typedef typename ::boost::unordered::detail::pick_grouped_node<A, value_type>::node node;
|
||||
typedef typename ::boost::unordered::detail::pick_grouped_node<A, value_type>::bucket bucket;
|
||||
typedef typename ::boost::unordered::detail::pick_grouped_node<A, value_type>::link_pointer link_pointer;
|
||||
typedef ::boost::unordered::detail::grouped_table_impl<types> table;
|
||||
typedef typename boost::unordered::detail::pick_grouped_node<A, value_type>::node node;
|
||||
typedef typename boost::unordered::detail::pick_grouped_node<A, value_type>::bucket bucket;
|
||||
typedef typename boost::unordered::detail::pick_grouped_node<A, value_type>::link_pointer link_pointer;
|
||||
typedef boost::unordered::detail::grouped_table_impl<types> table;
|
||||
|
||||
typedef ::boost::unordered::detail::map_extractor<key_type, value_type> extractor;
|
||||
typedef boost::unordered::detail::map_extractor<key_type, value_type> extractor;
|
||||
};
|
||||
|
||||
template <typename Types>
|
||||
struct grouped_table_impl : ::boost::unordered::detail::table<Types>
|
||||
struct grouped_table_impl : boost::unordered::detail::table<Types>
|
||||
{
|
||||
typedef ::boost::unordered::detail::table<Types> table;
|
||||
typedef boost::unordered::detail::table<Types> table;
|
||||
typedef typename table::value_type value_type;
|
||||
typedef typename table::bucket bucket;
|
||||
typedef typename table::buckets buckets;
|
||||
@ -197,13 +197,13 @@ namespace boost { namespace unordered { namespace detail {
|
||||
{}
|
||||
|
||||
grouped_table_impl(grouped_table_impl& x,
|
||||
::boost::unordered::detail::move_tag m)
|
||||
boost::unordered::detail::move_tag m)
|
||||
: table(x, m)
|
||||
{}
|
||||
|
||||
grouped_table_impl(grouped_table_impl& x,
|
||||
node_allocator const& a,
|
||||
::boost::unordered::detail::move_tag m)
|
||||
boost::unordered::detail::move_tag m)
|
||||
: table(x, a, m)
|
||||
{}
|
||||
|
||||
@ -441,8 +441,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
node_pointer emplace(::boost::unordered::detail::emplace_args1<
|
||||
::boost::unordered::detail::please_ignore_this_overload> const&)
|
||||
node_pointer emplace(boost::unordered::detail::emplace_args1<
|
||||
boost::unordered::detail::please_ignore_this_overload> const&)
|
||||
{
|
||||
BOOST_ASSERT(false);
|
||||
return this->begin();
|
||||
@ -465,12 +465,12 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// if hash function throws, or inserting > 1 element, basic exception
|
||||
// safety. Strong otherwise
|
||||
template <class I>
|
||||
typename ::boost::unordered::detail::enable_if_forward<I, void>::type
|
||||
typename boost::unordered::detail::enable_if_forward<I, void>::type
|
||||
insert_range(I i, I j)
|
||||
{
|
||||
if(i == j) return;
|
||||
|
||||
std::size_t distance = ::boost::unordered::detail::distance(i, j);
|
||||
std::size_t distance = boost::unordered::detail::distance(i, j);
|
||||
if(distance == 1) {
|
||||
node_constructor a(this->node_alloc());
|
||||
a.construct_node();
|
||||
@ -491,7 +491,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
|
||||
template <class I>
|
||||
typename ::boost::unordered::detail::disable_if_forward<I, void>::type
|
||||
typename boost::unordered::detail::disable_if_forward<I, void>::type
|
||||
insert_range(I i, I j)
|
||||
{
|
||||
node_constructor a(this->node_alloc());
|
||||
@ -614,6 +614,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
previous_pointer prev = static_cast<previous_pointer>(begin->group_prev_);
|
||||
|
||||
if(prev->next_ != static_cast<link_pointer>(begin)) {
|
||||
std::cout << "A" << std::endl;
|
||||
// The node is at the beginning of a group.
|
||||
|
||||
// Find the previous node pointer:
|
||||
@ -625,6 +626,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
if (end) split_group(end);
|
||||
}
|
||||
else {
|
||||
std::cout << "B" << std::endl;
|
||||
node_pointer group1 = split_group(begin);
|
||||
|
||||
if (end) {
|
||||
|
@ -93,7 +93,7 @@ namespace detail {
|
||||
struct map_extractor
|
||||
{
|
||||
typedef ValueType value_type;
|
||||
typedef typename ::boost::remove_const<Key>::type key_type;
|
||||
typedef typename boost::remove_const<Key>::type key_type;
|
||||
|
||||
static key_type const& extract(value_type const& v)
|
||||
{
|
||||
|
@ -32,13 +32,13 @@ namespace boost { namespace unordered { namespace iterator_detail {
|
||||
|
||||
template <typename NodePointer, typename Value>
|
||||
struct l_iterator
|
||||
: public ::boost::iterator<
|
||||
: public boost::iterator<
|
||||
std::forward_iterator_tag, Value, std::ptrdiff_t,
|
||||
NodePointer, Value&>
|
||||
{
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
template <typename ConstNodePointer, typename NodePointer2, typename Value2>
|
||||
friend struct ::boost::unordered::iterator_detail::cl_iterator;
|
||||
friend struct boost::unordered::iterator_detail::cl_iterator;
|
||||
private:
|
||||
#endif
|
||||
typedef NodePointer node_pointer;
|
||||
@ -85,11 +85,11 @@ namespace boost { namespace unordered { namespace iterator_detail {
|
||||
|
||||
template <typename ConstNodePointer, typename NodePointer, typename Value>
|
||||
struct cl_iterator
|
||||
: public ::boost::iterator<
|
||||
: public boost::iterator<
|
||||
std::forward_iterator_tag, Value, std::ptrdiff_t,
|
||||
ConstNodePointer, Value const&>
|
||||
{
|
||||
friend struct ::boost::unordered::iterator_detail::l_iterator
|
||||
friend struct boost::unordered::iterator_detail::l_iterator
|
||||
<NodePointer, Value>;
|
||||
private:
|
||||
|
||||
@ -142,13 +142,13 @@ namespace boost { namespace unordered { namespace iterator_detail {
|
||||
|
||||
template <typename NodePointer, typename Value>
|
||||
struct iterator
|
||||
: public ::boost::iterator<
|
||||
: public boost::iterator<
|
||||
std::forward_iterator_tag, Value, std::ptrdiff_t,
|
||||
NodePointer, Value&>
|
||||
{
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
template <typename ConstNodePointer, typename NodePointer2, typename Value2>
|
||||
friend struct ::boost::unordered::iterator_detail::c_iterator;
|
||||
friend struct boost::unordered::iterator_detail::c_iterator;
|
||||
private:
|
||||
#endif
|
||||
typedef NodePointer node_pointer;
|
||||
@ -187,21 +187,21 @@ namespace boost { namespace unordered { namespace iterator_detail {
|
||||
|
||||
template <typename ConstNodePointer, typename NodePointer, typename Value>
|
||||
struct c_iterator
|
||||
: public ::boost::iterator<
|
||||
: public boost::iterator<
|
||||
std::forward_iterator_tag, Value, std::ptrdiff_t,
|
||||
ConstNodePointer, Value const&>
|
||||
{
|
||||
friend struct ::boost::unordered::iterator_detail::iterator<NodePointer, Value>;
|
||||
friend struct boost::unordered::iterator_detail::iterator<NodePointer, Value>;
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
template <typename K, typename T, typename H, typename P, typename A>
|
||||
friend class ::boost::unordered::unordered_map;
|
||||
friend class boost::unordered::unordered_map;
|
||||
template <typename K, typename T, typename H, typename P, typename A>
|
||||
friend class ::boost::unordered::unordered_multimap;
|
||||
friend class boost::unordered::unordered_multimap;
|
||||
template <typename T, typename H, typename P, typename A>
|
||||
friend class ::boost::unordered::unordered_set;
|
||||
friend class boost::unordered::unordered_set;
|
||||
template <typename T, typename H, typename P, typename A>
|
||||
friend class ::boost::unordered::unordered_multiset;
|
||||
friend class boost::unordered::unordered_multiset;
|
||||
|
||||
private:
|
||||
#endif
|
||||
@ -263,9 +263,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
{
|
||||
typedef ValueType value_type;
|
||||
|
||||
typename ::boost::aligned_storage<
|
||||
typename boost::aligned_storage<
|
||||
sizeof(value_type),
|
||||
::boost::alignment_of<value_type>::value>::type data_;
|
||||
boost::alignment_of<value_type>::value>::type data_;
|
||||
|
||||
void* address() {
|
||||
return this;
|
||||
@ -286,11 +286,11 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <typename Types>
|
||||
struct table :
|
||||
::boost::unordered::detail::buckets<
|
||||
boost::unordered::detail::buckets<
|
||||
typename Types::allocator,
|
||||
typename Types::bucket,
|
||||
typename Types::node>,
|
||||
::boost::unordered::detail::functions<
|
||||
boost::unordered::detail::functions<
|
||||
typename Types::hasher,
|
||||
typename Types::key_equal>
|
||||
{
|
||||
@ -306,11 +306,11 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef typename Types::table table_impl;
|
||||
typedef typename Types::link_pointer link_pointer;
|
||||
|
||||
typedef ::boost::unordered::detail::functions<
|
||||
typedef boost::unordered::detail::functions<
|
||||
typename Types::hasher,
|
||||
typename Types::key_equal> functions;
|
||||
|
||||
typedef ::boost::unordered::detail::buckets<
|
||||
typedef boost::unordered::detail::buckets<
|
||||
typename Types::allocator,
|
||||
typename Types::bucket,
|
||||
typename Types::node> buckets;
|
||||
@ -320,10 +320,10 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef typename buckets::node_pointer node_pointer;
|
||||
typedef typename buckets::const_node_pointer const_node_pointer;
|
||||
|
||||
typedef ::boost::unordered::iterator_detail::iterator<node_pointer, value_type> iterator;
|
||||
typedef ::boost::unordered::iterator_detail::c_iterator<const_node_pointer, node_pointer, value_type> c_iterator;
|
||||
typedef ::boost::unordered::iterator_detail::l_iterator<node_pointer, value_type> l_iterator;
|
||||
typedef ::boost::unordered::iterator_detail::cl_iterator<const_node_pointer, node_pointer, value_type> cl_iterator;
|
||||
typedef boost::unordered::iterator_detail::iterator<node_pointer, value_type> iterator;
|
||||
typedef boost::unordered::iterator_detail::c_iterator<const_node_pointer, node_pointer, value_type> c_iterator;
|
||||
typedef boost::unordered::iterator_detail::l_iterator<node_pointer, value_type> l_iterator;
|
||||
typedef boost::unordered::iterator_detail::cl_iterator<const_node_pointer, node_pointer, value_type> cl_iterator;
|
||||
|
||||
// Members
|
||||
|
||||
@ -338,7 +338,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
using namespace std;
|
||||
|
||||
// size < mlf_ * count
|
||||
return ::boost::unordered::detail::double_to_size_t(ceil(
|
||||
return boost::unordered::detail::double_to_size_t(ceil(
|
||||
static_cast<double>(this->mlf_) *
|
||||
static_cast<double>(this->max_bucket_count())
|
||||
)) - 1;
|
||||
@ -350,7 +350,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
// From 6.3.1/13:
|
||||
// Only resize when size >= mlf_ * count
|
||||
return ::boost::unordered::detail::double_to_size_t(ceil(
|
||||
return boost::unordered::detail::double_to_size_t(ceil(
|
||||
static_cast<double>(this->mlf_) *
|
||||
static_cast<double>(this->bucket_count_)
|
||||
));
|
||||
@ -377,8 +377,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// Or from rehash post-condition:
|
||||
// count > size / mlf_
|
||||
|
||||
return ::boost::unordered::detail::next_prime(
|
||||
::boost::unordered::detail::double_to_size_t(floor(
|
||||
return boost::unordered::detail::next_prime(
|
||||
boost::unordered::detail::double_to_size_t(floor(
|
||||
static_cast<double>(size) /
|
||||
static_cast<double>(mlf_))) + 1);
|
||||
}
|
||||
@ -390,7 +390,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
hasher const& hf,
|
||||
key_equal const& eq,
|
||||
node_allocator const& a) :
|
||||
buckets(a, ::boost::unordered::detail::next_prime(num_buckets)),
|
||||
buckets(a, boost::unordered::detail::next_prime(num_buckets)),
|
||||
functions(hf, eq),
|
||||
mlf_(1.0f),
|
||||
max_load_(0)
|
||||
@ -409,7 +409,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
|
||||
// TODO: Why calculate_max_load?
|
||||
table(table& x, ::boost::unordered::detail::move_tag m) :
|
||||
table(table& x, boost::unordered::detail::move_tag m) :
|
||||
buckets(x, m),
|
||||
functions(x),
|
||||
mlf_(x.mlf_),
|
||||
@ -419,14 +419,14 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// TODO: Why not calculate_max_load?
|
||||
// TODO: Why do I use x's bucket count?
|
||||
table(table& x, node_allocator const& a,
|
||||
::boost::unordered::detail::move_tag m) :
|
||||
boost::unordered::detail::move_tag m) :
|
||||
buckets(a, x.bucket_count_),
|
||||
functions(x),
|
||||
mlf_(x.mlf_),
|
||||
max_load_(x.max_load_)
|
||||
{
|
||||
if(a == x.node_alloc()) {
|
||||
this->buckets::swap(x, boost::unordered::detail::false_type());
|
||||
this->buckets::swap(x, false_type());
|
||||
}
|
||||
else if(x.size_) {
|
||||
// Use a temporary table because move_buckets_to leaves the
|
||||
@ -450,18 +450,18 @@ namespace boost { namespace unordered { namespace detail {
|
||||
void assign(table const& x)
|
||||
{
|
||||
assign(x,
|
||||
::boost::unordered::detail::integral_constant<bool,
|
||||
boost::unordered::detail::integral_constant<bool,
|
||||
allocator_traits<node_allocator>::
|
||||
propagate_on_container_copy_assignment::value>());
|
||||
}
|
||||
|
||||
void assign(table const& x, boost::unordered::detail::false_type)
|
||||
void assign(table const& x, false_type)
|
||||
{
|
||||
table tmp(x, this->node_alloc());
|
||||
this->swap(tmp, boost::unordered::detail::false_type());
|
||||
this->swap(tmp, false_type());
|
||||
}
|
||||
|
||||
void assign(table const& x, boost::unordered::detail::true_type)
|
||||
void assign(table const& x, true_type)
|
||||
{
|
||||
table tmp(x, x.node_alloc());
|
||||
// Need to delete before setting the allocator so that buckets
|
||||
@ -469,25 +469,25 @@ namespace boost { namespace unordered { namespace detail {
|
||||
if(this->buckets_) this->delete_buckets();
|
||||
// TODO: Can allocator assignment throw?
|
||||
this->allocators_.assign(x.allocators_);
|
||||
this->swap(tmp, boost::unordered::detail::false_type());
|
||||
this->swap(tmp, false_type());
|
||||
}
|
||||
|
||||
void move_assign(table& x)
|
||||
{
|
||||
move_assign(x,
|
||||
::boost::unordered::detail::integral_constant<bool,
|
||||
boost::unordered::detail::integral_constant<bool,
|
||||
allocator_traits<node_allocator>::
|
||||
propagate_on_container_move_assignment::value>());
|
||||
}
|
||||
|
||||
void move_assign(table& x, boost::unordered::detail::true_type)
|
||||
void move_assign(table& x, true_type)
|
||||
{
|
||||
if(this->buckets_) this->delete_buckets();
|
||||
this->allocators_.move_assign(x.allocators_);
|
||||
move_assign_no_alloc(x);
|
||||
}
|
||||
|
||||
void move_assign(table& x, boost::unordered::detail::false_type)
|
||||
void move_assign(table& x, false_type)
|
||||
{
|
||||
if(this->node_alloc() == x.node_alloc()) {
|
||||
if(this->buckets_) this->delete_buckets();
|
||||
@ -647,7 +647,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
else {
|
||||
min_buckets = next_prime((std::max)(min_buckets,
|
||||
::boost::unordered::detail::double_to_size_t(floor(
|
||||
boost::unordered::detail::double_to_size_t(floor(
|
||||
static_cast<double>(this->size_) /
|
||||
static_cast<double>(mlf_))) + 1));
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <typename VoidPointer, typename T>
|
||||
struct node :
|
||||
::boost::unordered::detail::value_base<T>
|
||||
boost::unordered::detail::value_base<T>
|
||||
{
|
||||
typedef VoidPointer link_pointer;
|
||||
|
||||
@ -44,10 +44,10 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <typename T>
|
||||
struct ptr_node :
|
||||
::boost::unordered::detail::value_base<T>,
|
||||
::boost::unordered::detail::ptr_bucket
|
||||
boost::unordered::detail::value_base<T>,
|
||||
boost::unordered::detail::ptr_bucket
|
||||
{
|
||||
typedef ::boost::unordered::detail::ptr_bucket bucket_base;
|
||||
typedef boost::unordered::detail::ptr_bucket bucket_base;
|
||||
typedef ptr_bucket* link_pointer;
|
||||
|
||||
std::size_t hash_;
|
||||
@ -68,37 +68,37 @@ namespace boost { namespace unordered { namespace detail {
|
||||
template <typename A, typename T, typename VoidPointer, typename NodePtr, typename BucketPtr>
|
||||
struct pick_node2
|
||||
{
|
||||
typedef ::boost::unordered::detail::node<VoidPointer, T> node;
|
||||
typedef boost::unordered::detail::node<VoidPointer, T> node;
|
||||
|
||||
typedef typename ::boost::unordered::detail::allocator_traits<
|
||||
typename ::boost::unordered::detail::rebind_wrap<A, node>::type
|
||||
typedef typename boost::unordered::detail::allocator_traits<
|
||||
typename boost::unordered::detail::rebind_wrap<A, node>::type
|
||||
>::pointer node_pointer;
|
||||
|
||||
typedef ::boost::unordered::detail::bucket<node_pointer> bucket;
|
||||
typedef boost::unordered::detail::bucket<node_pointer> bucket;
|
||||
typedef VoidPointer link_pointer;
|
||||
};
|
||||
|
||||
template <typename A, typename T>
|
||||
struct pick_node2<A, T, void*,
|
||||
::boost::unordered::detail::ptr_node<T>*,
|
||||
::boost::unordered::detail::ptr_bucket*>
|
||||
boost::unordered::detail::ptr_node<T>*,
|
||||
boost::unordered::detail::ptr_bucket*>
|
||||
{
|
||||
typedef ::boost::unordered::detail::ptr_node<T> node;
|
||||
typedef ::boost::unordered::detail::ptr_bucket bucket;
|
||||
typedef boost::unordered::detail::ptr_node<T> node;
|
||||
typedef boost::unordered::detail::ptr_bucket bucket;
|
||||
typedef bucket* link_pointer;
|
||||
};
|
||||
|
||||
template <typename A, typename T>
|
||||
struct pick_node
|
||||
{
|
||||
typedef ::boost::unordered::detail::allocator_traits<
|
||||
typename ::boost::unordered::detail::rebind_wrap<A,
|
||||
::boost::unordered::detail::ptr_node<T> >::type
|
||||
typedef boost::unordered::detail::allocator_traits<
|
||||
typename boost::unordered::detail::rebind_wrap<A,
|
||||
boost::unordered::detail::ptr_node<T> >::type
|
||||
> tentative_node_traits;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<
|
||||
typename ::boost::unordered::detail::rebind_wrap<A,
|
||||
::boost::unordered::detail::ptr_bucket >::type
|
||||
typedef boost::unordered::detail::allocator_traits<
|
||||
typename boost::unordered::detail::rebind_wrap<A,
|
||||
boost::unordered::detail::ptr_bucket >::type
|
||||
> tentative_bucket_traits;
|
||||
|
||||
typedef pick_node2<A, T,
|
||||
@ -120,17 +120,17 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef H hasher;
|
||||
typedef P key_equal;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
typedef typename traits::void_pointer void_pointer;
|
||||
typedef value_type key_type;
|
||||
|
||||
typedef typename ::boost::unordered::detail::pick_node<A, value_type>::node node;
|
||||
typedef typename ::boost::unordered::detail::pick_node<A, value_type>::bucket bucket;
|
||||
typedef typename ::boost::unordered::detail::pick_node<A, value_type>::link_pointer link_pointer;
|
||||
typedef ::boost::unordered::detail::table_impl<types> table;
|
||||
typedef typename boost::unordered::detail::pick_node<A, value_type>::node node;
|
||||
typedef typename boost::unordered::detail::pick_node<A, value_type>::bucket bucket;
|
||||
typedef typename boost::unordered::detail::pick_node<A, value_type>::link_pointer link_pointer;
|
||||
typedef boost::unordered::detail::table_impl<types> table;
|
||||
|
||||
typedef ::boost::unordered::detail::set_extractor<value_type> extractor;
|
||||
typedef boost::unordered::detail::set_extractor<value_type> extractor;
|
||||
};
|
||||
|
||||
template <typename A, typename K, typename H, typename P>
|
||||
@ -143,22 +143,22 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef P key_equal;
|
||||
typedef K key_type;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
typedef typename traits::void_pointer void_pointer;
|
||||
|
||||
typedef typename ::boost::unordered::detail::pick_node<A, value_type>::node node;
|
||||
typedef typename ::boost::unordered::detail::pick_node<A, value_type>::bucket bucket;
|
||||
typedef typename ::boost::unordered::detail::pick_node<A, value_type>::link_pointer link_pointer;
|
||||
typedef ::boost::unordered::detail::table_impl<types> table;
|
||||
typedef typename boost::unordered::detail::pick_node<A, value_type>::node node;
|
||||
typedef typename boost::unordered::detail::pick_node<A, value_type>::bucket bucket;
|
||||
typedef typename boost::unordered::detail::pick_node<A, value_type>::link_pointer link_pointer;
|
||||
typedef boost::unordered::detail::table_impl<types> table;
|
||||
|
||||
typedef ::boost::unordered::detail::map_extractor<key_type, value_type> extractor;
|
||||
typedef boost::unordered::detail::map_extractor<key_type, value_type> extractor;
|
||||
};
|
||||
|
||||
template <typename Types>
|
||||
struct table_impl : ::boost::unordered::detail::table<Types>
|
||||
struct table_impl : boost::unordered::detail::table<Types>
|
||||
{
|
||||
typedef ::boost::unordered::detail::table<Types> table;
|
||||
typedef boost::unordered::detail::table<Types> table;
|
||||
typedef typename table::value_type value_type;
|
||||
typedef typename table::bucket bucket;
|
||||
typedef typename table::buckets buckets;
|
||||
@ -195,13 +195,13 @@ namespace boost { namespace unordered { namespace detail {
|
||||
{}
|
||||
|
||||
table_impl(table_impl& x,
|
||||
::boost::unordered::detail::move_tag m)
|
||||
boost::unordered::detail::move_tag m)
|
||||
: table(x, m)
|
||||
{}
|
||||
|
||||
table_impl(table_impl& x,
|
||||
node_allocator const& a,
|
||||
::boost::unordered::detail::move_tag m)
|
||||
boost::unordered::detail::move_tag m)
|
||||
: table(x, a, m)
|
||||
{}
|
||||
|
||||
@ -248,7 +248,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
if (it) return it->value();
|
||||
}
|
||||
|
||||
::boost::throw_exception(
|
||||
boost::throw_exception(
|
||||
std::out_of_range("Unable to find key in unordered_map."));
|
||||
}
|
||||
|
||||
@ -349,8 +349,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
emplace_return emplace(::boost::unordered::detail::emplace_args1<
|
||||
::boost::unordered::detail::please_ignore_this_overload> const&)
|
||||
emplace_return emplace(boost::unordered::detail::emplace_args1<
|
||||
boost::unordered::detail::please_ignore_this_overload> const&)
|
||||
{
|
||||
BOOST_ASSERT(false);
|
||||
return emplace_return(this->begin(), false);
|
||||
@ -472,7 +472,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
a.construct_node();
|
||||
a.construct_value2(*i);
|
||||
this->reserve_for_insert(this->size_ +
|
||||
::boost::unordered::detail::insert_size(i, j));
|
||||
boost::unordered::detail::insert_size(i, j));
|
||||
this->add_node(a, hash);
|
||||
}
|
||||
|
||||
@ -490,7 +490,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
if(this->size_ + 1 >= this->max_load_)
|
||||
this->reserve_for_insert(this->size_ +
|
||||
::boost::unordered::detail::insert_size(i, j));
|
||||
boost::unordered::detail::insert_size(i, j));
|
||||
|
||||
// Nothing after this point can throw.
|
||||
this->add_node(a, hash);
|
||||
|
@ -33,22 +33,22 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <typename I>
|
||||
struct is_forward :
|
||||
::boost::is_convertible<
|
||||
typename ::boost::iterator_traversal<I>::type,
|
||||
::boost::forward_traversal_tag>
|
||||
boost::is_convertible<
|
||||
typename boost::iterator_traversal<I>::type,
|
||||
boost::forward_traversal_tag>
|
||||
{};
|
||||
|
||||
template <typename I, typename ReturnType>
|
||||
struct enable_if_forward :
|
||||
::boost::enable_if_c<
|
||||
::boost::unordered::detail::is_forward<I>::value,
|
||||
boost::enable_if_c<
|
||||
boost::unordered::detail::is_forward<I>::value,
|
||||
ReturnType>
|
||||
{};
|
||||
|
||||
template <typename I, typename ReturnType>
|
||||
struct disable_if_forward :
|
||||
::boost::disable_if_c<
|
||||
::boost::unordered::detail::is_forward<I>::value,
|
||||
boost::disable_if_c<
|
||||
boost::unordered::detail::is_forward<I>::value,
|
||||
ReturnType>
|
||||
{};
|
||||
|
||||
@ -135,7 +135,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <class I>
|
||||
inline typename
|
||||
::boost::unordered::detail::enable_if_forward<I, std::size_t>::type
|
||||
boost::unordered::detail::enable_if_forward<I, std::size_t>::type
|
||||
insert_size(I i, I j)
|
||||
{
|
||||
return std::distance(i, j);
|
||||
@ -143,7 +143,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <class I>
|
||||
inline typename
|
||||
::boost::unordered::detail::disable_if_forward<I, std::size_t>::type
|
||||
boost::unordered::detail::disable_if_forward<I, std::size_t>::type
|
||||
insert_size(I, I)
|
||||
{
|
||||
return 1;
|
||||
@ -151,11 +151,11 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
template <class I>
|
||||
inline std::size_t initial_size(I i, I j,
|
||||
std::size_t num_buckets = ::boost::unordered::detail::default_bucket_count)
|
||||
std::size_t num_buckets = boost::unordered::detail::default_bucket_count)
|
||||
{
|
||||
// TODO: Why +1?
|
||||
return (std::max)(
|
||||
::boost::unordered::detail::insert_size(i, j) + 1,
|
||||
boost::unordered::detail::insert_size(i, j) + 1,
|
||||
num_buckets);
|
||||
}
|
||||
|
||||
|
@ -54,14 +54,14 @@ namespace unordered
|
||||
|
||||
private:
|
||||
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
allocator_type, value_type>::type
|
||||
value_allocator;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<value_allocator>
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
allocator_traits;
|
||||
|
||||
typedef ::boost::unordered::detail::map<value_allocator, K, H, P>
|
||||
typedef boost::unordered::detail::map<value_allocator, K, H, P>
|
||||
types;
|
||||
typedef typename types::table table;
|
||||
|
||||
@ -90,7 +90,7 @@ namespace unordered
|
||||
// constructors
|
||||
|
||||
explicit unordered_map(
|
||||
size_type = ::boost::unordered::detail::default_bucket_count,
|
||||
size_type = boost::unordered::detail::default_bucket_count,
|
||||
const hasher& = hasher(),
|
||||
const key_equal& = key_equal(),
|
||||
const allocator_type& = allocator_type());
|
||||
@ -122,7 +122,7 @@ namespace unordered
|
||||
unordered_map(unordered_map const&, allocator_type const&);
|
||||
|
||||
unordered_map(BOOST_RV_REF(unordered_map) other)
|
||||
: table_(other.table_, ::boost::unordered::detail::move_tag())
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ namespace unordered
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
unordered_map(
|
||||
std::initializer_list<value_type>,
|
||||
size_type = ::boost::unordered::detail::default_bucket_count,
|
||||
size_type = boost::unordered::detail::default_bucket_count,
|
||||
const hasher& = hasher(),
|
||||
const key_equal&l = key_equal(),
|
||||
const allocator_type& = allocator_type());
|
||||
@ -237,7 +237,7 @@ namespace unordered
|
||||
) \
|
||||
{ \
|
||||
return table_.emplace( \
|
||||
::boost::unordered::detail::create_emplace_args( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)); \
|
||||
@ -252,7 +252,7 @@ namespace unordered
|
||||
) \
|
||||
{ \
|
||||
return iterator(table_.emplace( \
|
||||
::boost::unordered::detail::create_emplace_args( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)).first); \
|
||||
@ -445,14 +445,14 @@ namespace unordered
|
||||
|
||||
private:
|
||||
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
allocator_type, value_type>::type
|
||||
value_allocator;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<value_allocator>
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
allocator_traits;
|
||||
|
||||
typedef ::boost::unordered::detail::multimap<value_allocator, K, H, P>
|
||||
typedef boost::unordered::detail::multimap<value_allocator, K, H, P>
|
||||
types;
|
||||
typedef typename types::table table;
|
||||
|
||||
@ -481,7 +481,7 @@ namespace unordered
|
||||
// constructors
|
||||
|
||||
explicit unordered_multimap(
|
||||
size_type = ::boost::unordered::detail::default_bucket_count,
|
||||
size_type = boost::unordered::detail::default_bucket_count,
|
||||
const hasher& = hasher(),
|
||||
const key_equal& = key_equal(),
|
||||
const allocator_type& = allocator_type());
|
||||
@ -513,7 +513,7 @@ namespace unordered
|
||||
unordered_multimap(unordered_multimap const&, allocator_type const&);
|
||||
|
||||
unordered_multimap(BOOST_RV_REF(unordered_multimap) other)
|
||||
: table_(other.table_, ::boost::unordered::detail::move_tag())
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -524,7 +524,7 @@ namespace unordered
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
unordered_multimap(
|
||||
std::initializer_list<value_type>,
|
||||
size_type = ::boost::unordered::detail::default_bucket_count,
|
||||
size_type = boost::unordered::detail::default_bucket_count,
|
||||
const hasher& = hasher(),
|
||||
const key_equal&l = key_equal(),
|
||||
const allocator_type& = allocator_type());
|
||||
@ -628,7 +628,7 @@ namespace unordered
|
||||
) \
|
||||
{ \
|
||||
return iterator(table_.emplace( \
|
||||
::boost::unordered::detail::create_emplace_args( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
))); \
|
||||
@ -643,7 +643,7 @@ namespace unordered
|
||||
) \
|
||||
{ \
|
||||
return iterator(table_.emplace( \
|
||||
::boost::unordered::detail::create_emplace_args( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
))); \
|
||||
@ -828,7 +828,7 @@ namespace unordered
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
unordered_map<K,T,H,P,A>::unordered_map(allocator_type const& a)
|
||||
: table_(::boost::unordered::detail::default_bucket_count,
|
||||
: table_(boost::unordered::detail::default_bucket_count,
|
||||
hasher(), key_equal(), a)
|
||||
{
|
||||
}
|
||||
@ -843,7 +843,7 @@ namespace unordered
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
unordered_map<K,T,H,P,A>::unordered_map(InputIt f, InputIt l)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l),
|
||||
: table_(boost::unordered::detail::initial_size(f, l),
|
||||
hasher(), key_equal(), allocator_type())
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
@ -856,7 +856,7 @@ namespace unordered
|
||||
size_type n,
|
||||
const hasher &hf,
|
||||
const key_equal &eql)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l, n),
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n),
|
||||
hf, eql, allocator_type())
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
@ -870,7 +870,7 @@ namespace unordered
|
||||
const hasher &hf,
|
||||
const key_equal &eql,
|
||||
const allocator_type &a)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
}
|
||||
@ -890,7 +890,7 @@ namespace unordered
|
||||
template <class K, class T, class H, class P, class A>
|
||||
unordered_map<K,T,H,P,A>::unordered_map(
|
||||
unordered_map&& other, allocator_type const& a)
|
||||
: table_(other.table_, a, ::boost::unordered::detail::move_tag())
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -903,7 +903,7 @@ namespace unordered
|
||||
std::initializer_list<value_type> list, size_type n,
|
||||
const hasher &hf, const key_equal &eql, const allocator_type &a)
|
||||
: table_(
|
||||
::boost::unordered::detail::initial_size(
|
||||
boost::unordered::detail::initial_size(
|
||||
list.begin(), list.end(), n),
|
||||
hf, eql, a)
|
||||
{
|
||||
@ -1155,7 +1155,7 @@ namespace unordered
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
unordered_multimap<K,T,H,P,A>::unordered_multimap(allocator_type const& a)
|
||||
: table_(::boost::unordered::detail::default_bucket_count,
|
||||
: table_(boost::unordered::detail::default_bucket_count,
|
||||
hasher(), key_equal(), a)
|
||||
{
|
||||
}
|
||||
@ -1170,7 +1170,7 @@ namespace unordered
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
unordered_multimap<K,T,H,P,A>::unordered_multimap(InputIt f, InputIt l)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l),
|
||||
: table_(boost::unordered::detail::initial_size(f, l),
|
||||
hasher(), key_equal(), allocator_type())
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
@ -1183,7 +1183,7 @@ namespace unordered
|
||||
size_type n,
|
||||
const hasher &hf,
|
||||
const key_equal &eql)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l, n),
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n),
|
||||
hf, eql, allocator_type())
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
@ -1197,7 +1197,7 @@ namespace unordered
|
||||
const hasher &hf,
|
||||
const key_equal &eql,
|
||||
const allocator_type &a)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
}
|
||||
@ -1217,7 +1217,7 @@ namespace unordered
|
||||
template <class K, class T, class H, class P, class A>
|
||||
unordered_multimap<K,T,H,P,A>::unordered_multimap(
|
||||
unordered_multimap&& other, allocator_type const& a)
|
||||
: table_(other.table_, a, ::boost::unordered::detail::move_tag())
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -1230,7 +1230,7 @@ namespace unordered
|
||||
std::initializer_list<value_type> list, size_type n,
|
||||
const hasher &hf, const key_equal &eql, const allocator_type &a)
|
||||
: table_(
|
||||
::boost::unordered::detail::initial_size(
|
||||
boost::unordered::detail::initial_size(
|
||||
list.begin(), list.end(), n),
|
||||
hf, eql, a)
|
||||
{
|
||||
|
@ -37,11 +37,11 @@ namespace boost
|
||||
unordered_multimap<K, T, H, P, A>&);
|
||||
}
|
||||
|
||||
using ::boost::unordered::unordered_map;
|
||||
using ::boost::unordered::unordered_multimap;
|
||||
using ::boost::unordered::swap;
|
||||
using ::boost::unordered::operator==;
|
||||
using ::boost::unordered::operator!=;
|
||||
using boost::unordered::unordered_map;
|
||||
using boost::unordered::unordered_multimap;
|
||||
using boost::unordered::swap;
|
||||
using boost::unordered::operator==;
|
||||
using boost::unordered::operator!=;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -52,14 +52,14 @@ namespace unordered
|
||||
|
||||
private:
|
||||
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
allocator_type, value_type>::type
|
||||
value_allocator;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<value_allocator>
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
allocator_traits;
|
||||
|
||||
typedef ::boost::unordered::detail::set<value_allocator, H, P>
|
||||
typedef boost::unordered::detail::set<value_allocator, H, P>
|
||||
types;
|
||||
typedef typename types::table table;
|
||||
|
||||
@ -88,7 +88,7 @@ namespace unordered
|
||||
// constructors
|
||||
|
||||
explicit unordered_set(
|
||||
size_type = ::boost::unordered::detail::default_bucket_count,
|
||||
size_type = boost::unordered::detail::default_bucket_count,
|
||||
const hasher& = hasher(),
|
||||
const key_equal& = key_equal(),
|
||||
const allocator_type& = allocator_type());
|
||||
@ -120,7 +120,7 @@ namespace unordered
|
||||
unordered_set(unordered_set const&, allocator_type const&);
|
||||
|
||||
unordered_set(BOOST_RV_REF(unordered_set) other)
|
||||
: table_(other.table_, ::boost::unordered::detail::move_tag())
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ namespace unordered
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
unordered_set(
|
||||
std::initializer_list<value_type>,
|
||||
size_type = ::boost::unordered::detail::default_bucket_count,
|
||||
size_type = boost::unordered::detail::default_bucket_count,
|
||||
const hasher& = hasher(),
|
||||
const key_equal&l = key_equal(),
|
||||
const allocator_type& = allocator_type());
|
||||
@ -235,7 +235,7 @@ namespace unordered
|
||||
) \
|
||||
{ \
|
||||
return table_.emplace( \
|
||||
::boost::unordered::detail::create_emplace_args( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)); \
|
||||
@ -250,7 +250,7 @@ namespace unordered
|
||||
) \
|
||||
{ \
|
||||
return iterator(table_.emplace( \
|
||||
::boost::unordered::detail::create_emplace_args( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)).first); \
|
||||
@ -427,14 +427,14 @@ namespace unordered
|
||||
|
||||
private:
|
||||
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
allocator_type, value_type>::type
|
||||
value_allocator;
|
||||
|
||||
typedef ::boost::unordered::detail::allocator_traits<value_allocator>
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
allocator_traits;
|
||||
|
||||
typedef ::boost::unordered::detail::multiset<value_allocator, H, P>
|
||||
typedef boost::unordered::detail::multiset<value_allocator, H, P>
|
||||
types;
|
||||
typedef typename types::table table;
|
||||
|
||||
@ -463,7 +463,7 @@ namespace unordered
|
||||
// constructors
|
||||
|
||||
explicit unordered_multiset(
|
||||
size_type = ::boost::unordered::detail::default_bucket_count,
|
||||
size_type = boost::unordered::detail::default_bucket_count,
|
||||
const hasher& = hasher(),
|
||||
const key_equal& = key_equal(),
|
||||
const allocator_type& = allocator_type());
|
||||
@ -495,7 +495,7 @@ namespace unordered
|
||||
unordered_multiset(unordered_multiset const&, allocator_type const&);
|
||||
|
||||
unordered_multiset(BOOST_RV_REF(unordered_multiset) other)
|
||||
: table_(other.table_, ::boost::unordered::detail::move_tag())
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ namespace unordered
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
unordered_multiset(
|
||||
std::initializer_list<value_type>,
|
||||
size_type = ::boost::unordered::detail::default_bucket_count,
|
||||
size_type = boost::unordered::detail::default_bucket_count,
|
||||
const hasher& = hasher(),
|
||||
const key_equal&l = key_equal(),
|
||||
const allocator_type& = allocator_type());
|
||||
@ -610,7 +610,7 @@ namespace unordered
|
||||
) \
|
||||
{ \
|
||||
return iterator(table_.emplace( \
|
||||
::boost::unordered::detail::create_emplace_args( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
))); \
|
||||
@ -625,7 +625,7 @@ namespace unordered
|
||||
) \
|
||||
{ \
|
||||
return iterator(table_.emplace( \
|
||||
::boost::unordered::detail::create_emplace_args( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
))); \
|
||||
@ -800,7 +800,7 @@ namespace unordered
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_set<T,H,P,A>::unordered_set(allocator_type const& a)
|
||||
: table_(::boost::unordered::detail::default_bucket_count,
|
||||
: table_(boost::unordered::detail::default_bucket_count,
|
||||
hasher(), key_equal(), a)
|
||||
{
|
||||
}
|
||||
@ -815,7 +815,7 @@ namespace unordered
|
||||
template <class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
unordered_set<T,H,P,A>::unordered_set(InputIt f, InputIt l)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l),
|
||||
: table_(boost::unordered::detail::initial_size(f, l),
|
||||
hasher(), key_equal(), allocator_type())
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
@ -828,7 +828,7 @@ namespace unordered
|
||||
size_type n,
|
||||
const hasher &hf,
|
||||
const key_equal &eql)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l, n),
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n),
|
||||
hf, eql, allocator_type())
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
@ -842,7 +842,7 @@ namespace unordered
|
||||
const hasher &hf,
|
||||
const key_equal &eql,
|
||||
const allocator_type &a)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
}
|
||||
@ -862,7 +862,7 @@ namespace unordered
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_set<T,H,P,A>::unordered_set(
|
||||
unordered_set&& other, allocator_type const& a)
|
||||
: table_(other.table_, a, ::boost::unordered::detail::move_tag())
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -875,7 +875,7 @@ namespace unordered
|
||||
std::initializer_list<value_type> list, size_type n,
|
||||
const hasher &hf, const key_equal &eql, const allocator_type &a)
|
||||
: table_(
|
||||
::boost::unordered::detail::initial_size(
|
||||
boost::unordered::detail::initial_size(
|
||||
list.begin(), list.end(), n),
|
||||
hf, eql, a)
|
||||
{
|
||||
@ -1078,7 +1078,7 @@ namespace unordered
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_multiset<T,H,P,A>::unordered_multiset(allocator_type const& a)
|
||||
: table_(::boost::unordered::detail::default_bucket_count,
|
||||
: table_(boost::unordered::detail::default_bucket_count,
|
||||
hasher(), key_equal(), a)
|
||||
{
|
||||
}
|
||||
@ -1093,7 +1093,7 @@ namespace unordered
|
||||
template <class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
unordered_multiset<T,H,P,A>::unordered_multiset(InputIt f, InputIt l)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l),
|
||||
: table_(boost::unordered::detail::initial_size(f, l),
|
||||
hasher(), key_equal(), allocator_type())
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
@ -1106,7 +1106,7 @@ namespace unordered
|
||||
size_type n,
|
||||
const hasher &hf,
|
||||
const key_equal &eql)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l, n),
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n),
|
||||
hf, eql, allocator_type())
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
@ -1120,7 +1120,7 @@ namespace unordered
|
||||
const hasher &hf,
|
||||
const key_equal &eql,
|
||||
const allocator_type &a)
|
||||
: table_(::boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
{
|
||||
table_.insert_range(f, l);
|
||||
}
|
||||
@ -1140,7 +1140,7 @@ namespace unordered
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_multiset<T,H,P,A>::unordered_multiset(
|
||||
unordered_multiset&& other, allocator_type const& a)
|
||||
: table_(other.table_, a, ::boost::unordered::detail::move_tag())
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -1153,7 +1153,7 @@ namespace unordered
|
||||
std::initializer_list<value_type> list, size_type n,
|
||||
const hasher &hf, const key_equal &eql, const allocator_type &a)
|
||||
: table_(
|
||||
::boost::unordered::detail::initial_size(
|
||||
boost::unordered::detail::initial_size(
|
||||
list.begin(), list.end(), n),
|
||||
hf, eql, a)
|
||||
{
|
||||
|
@ -37,11 +37,11 @@ namespace boost
|
||||
unordered_multiset<T, H, P, A> &m2);
|
||||
}
|
||||
|
||||
using ::boost::unordered::unordered_set;
|
||||
using ::boost::unordered::unordered_multiset;
|
||||
using ::boost::unordered::swap;
|
||||
using ::boost::unordered::operator==;
|
||||
using ::boost::unordered::operator!=;
|
||||
using boost::unordered::unordered_set;
|
||||
using boost::unordered::unordered_multiset;
|
||||
using boost::unordered::swap;
|
||||
using boost::unordered::operator==;
|
||||
using boost::unordered::operator!=;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user