From 3a909c8747a38d285ff8c6a011157069234a5210 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 6 Oct 2011 08:03:25 +0000 Subject: [PATCH] Unordered: Better emplace_args implementation. And some misc. cleanup. [SVN r74750] --- .../unordered/detail/allocator_helpers.hpp | 255 ++++++------ include/boost/unordered/detail/buckets.hpp | 109 +++-- .../boost/unordered/detail/emplace_args.hpp | 388 ++++++------------ include/boost/unordered/detail/equivalent.hpp | 80 ++-- .../boost/unordered/detail/extract_key.hpp | 2 +- include/boost/unordered/detail/table.hpp | 78 ++-- include/boost/unordered/detail/unique.hpp | 78 ++-- include/boost/unordered/detail/util.hpp | 22 +- include/boost/unordered/unordered_map.hpp | 56 +-- include/boost/unordered/unordered_map_fwd.hpp | 10 +- include/boost/unordered/unordered_set.hpp | 56 +-- include/boost/unordered/unordered_set_fwd.hpp | 10 +- 12 files changed, 522 insertions(+), 622 deletions(-) diff --git a/include/boost/unordered/detail/allocator_helpers.hpp b/include/boost/unordered/detail/allocator_helpers.hpp index 9895fb8c..366de1cc 100644 --- a/include/boost/unordered/detail/allocator_helpers.hpp +++ b/include/boost/unordered/detail/allocator_helpers.hpp @@ -24,32 +24,40 @@ #include #include #include +#include #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS # include #endif #if !defined(BOOST_NO_0X_HDR_TYPE_TRAITS) -#include +# include +#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 struct integral_constant { enum { value = Value }; }; - typedef integral_constant true_type; - typedef integral_constant false_type; -}}} + + typedef boost::unordered::detail::integral_constant true_type; + typedef boost::unordered::detail::integral_constant false_type; + #endif -// TODO: Use std::addressof if available? -#include - -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 - struct allocator_traits : std::allocator_traits {}; - - template - struct rebind_wrap - { - typedef typename allocator_traits::rebind_alloc type; - }; -#else - // rebind_wrap + //////////////////////////////////////////////////////////////////////////// + // Bits and pieces for implementing traits // - // Rebind allocators. For some problematic libraries, use rebind_to - // from . - - template - struct rebind_wrap - { - typedef typename Alloc::BOOST_NESTED_TEMPLATE rebind::other - type; - }; + // Some of these are also used elsewhere template typename boost::add_lvalue_reference::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 \ - struct default_type_ ## tname { \ - \ - template \ - static choice1::type test(choice1, typename X::tname* = 0); \ - \ - template \ - static choice2::type test(choice2, void* = 0); \ - \ - struct DefaultWrap { typedef Default tname; }; \ - \ - enum { value = (1 == sizeof(test(choose()))) }; \ - \ - typedef typename boost::detail::if_true:: \ - BOOST_NESTED_TEMPLATE then \ - ::type::tname type; \ - } - -#else - - template - struct sfinae : T2 {}; - - #define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ - template \ - struct default_type_ ## tname { \ - \ - template \ - static typename sfinae::type \ - test(choice1); \ - \ - template \ - static choice2::type test(choice2); \ - \ - struct DefaultWrap { typedef Default tname; }; \ - \ - enum { value = (1 == sizeof(test(choose()))) }; \ - \ - typedef typename boost::detail::if_true:: \ - BOOST_NESTED_TEMPLATE then \ - ::type::tname type; \ - } - -#endif - - #define BOOST_UNORDERED_DEFAULT_TYPE(T,tname, arg) \ - typename default_type_ ## tname::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 \ - 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 \ struct impl \ { \ - enum { value = sizeof(is_private_type(( \ - make >().name args \ - , 0))) == sizeof(yes_type) }; \ + enum { value = sizeof( \ + boost::unordered::detail::is_private_type(( \ + make >().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 + struct allocator_traits : std::allocator_traits {}; + + template + struct rebind_wrap + { + typedef typename std::allocator_traits::rebind_alloc type; + }; + +#else + + // TODO: Does this match std::allocator_traits::rebind_alloc? + template + struct rebind_wrap + { + typedef typename Alloc::BOOST_NESTED_TEMPLATE rebind::other + type; + }; + +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1400 + + #define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ + template \ + struct default_type_ ## tname { \ + \ + template \ + static choice1::type test(choice1, typename X::tname* = 0); \ + \ + template \ + static choice2::type test(choice2, void* = 0); \ + \ + struct DefaultWrap { typedef Default tname; }; \ + \ + enum { value = (1 == sizeof(test(choose()))) }; \ + \ + typedef typename boost::detail::if_true:: \ + BOOST_NESTED_TEMPLATE then \ + ::type::tname type; \ + } + +#else + + template + struct sfinae : T2 {}; + + #define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ + template \ + struct default_type_ ## tname { \ + \ + template \ + static typename boost::unordered::detail::sfinae< \ + typename X::tname, choice1>::type \ + test(choice1); \ + \ + template \ + static choice2::type test(choice2); \ + \ + struct DefaultWrap { typedef Default tname; }; \ + \ + enum { value = (1 == sizeof(test(choose()))) }; \ + \ + typedef typename boost::detail::if_true:: \ + BOOST_NESTED_TEMPLATE then \ + ::type::tname type; \ + } + +#endif + + #define BOOST_UNORDERED_DEFAULT_TYPE(T,tname, arg) \ + typename default_type_ ## tname::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 BOOST_UNORDERED_HAS_FUNCTION( @@ -425,7 +447,7 @@ namespace boost { namespace unordered { namespace detail { static void destroy(Alloc&, T* p, typename boost::disable_if, 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 struct array_constructor { - typedef typename allocator_traits::pointer - pointer; + typedef boost::unordered::detail::allocator_traits 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::destroy(alloc_, - boost::addressof(*p)); + traits::destroy(alloc_, boost::addressof(*p)); - allocator_traits::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::allocate(alloc_, length_); + ptr_ = traits::allocate(alloc_, length_); pointer end = ptr_ + static_cast(length_); for(constructed_ = ptr_; constructed_ != end; ++constructed_) - allocator_traits::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 diff --git a/include/boost/unordered/detail/buckets.hpp b/include/boost/unordered/detail/buckets.hpp index 08d74b56..791bdd89 100644 --- a/include/boost/unordered/detail/buckets.hpp +++ b/include/boost/unordered/detail/buckets.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #if defined(BOOST_MSVC) @@ -28,7 +29,7 @@ namespace boost { namespace unordered { namespace detail { template struct table; template struct bucket; struct ptr_bucket; - template struct buckets; + template struct buckets; /////////////////////////////////////////////////////////////////// // @@ -40,7 +41,8 @@ namespace boost { namespace unordered { namespace detail { private: typedef NodeAlloc node_allocator; - typedef ::boost::unordered::detail::allocator_traits node_allocator_traits; + typedef boost::unordered::detail::allocator_traits + 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( - 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( + boost::unordered::detail::construct_impl2( node_->value_ptr(), boost::forward(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(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 traits; + typedef boost::unordered::detail::allocator_traits 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::type node_allocator; - typedef typename ::boost::unordered::detail::rebind_wrap::type bucket_allocator; - typedef ::boost::unordered::detail::allocator_traits node_allocator_traits; - typedef ::boost::unordered::detail::allocator_traits 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_constructor; + typedef typename boost::unordered::detail::rebind_wrap::type + node_allocator; + typedef typename boost::unordered::detail::rebind_wrap::type + bucket_allocator; + typedef boost::unordered::detail::allocator_traits + node_allocator_traits; + typedef boost::unordered::detail::allocator_traits + 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_constructor; // Members bucket_pointer buckets_; std::size_t bucket_count_; std::size_t size_; - ::boost::unordered::detail::compressed allocators_; + boost::unordered::detail::compressed + 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(prev->next_) : node_pointer(); + return prev ? static_cast(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 - buckets(::boost::unordered::detail::table& x, - ::boost::unordered::detail::move_tag m) : + buckets(boost::unordered::detail::table& 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 + boost::unordered::detail::array_constructor 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(this->bucket_count_))->next_ = - a.release(); + (constructor.get() + + static_cast(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 function_pair; - typedef typename ::boost::aligned_storage< + typedef typename boost::aligned_storage< sizeof(function_pair), - ::boost::alignment_of::value>::type aligned_function; + boost::alignment_of::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 { diff --git a/include/boost/unordered/detail/emplace_args.hpp b/include/boost/unordered/detail/emplace_args.hpp index f65f4107..10017468 100644 --- a/include/boost/unordered/detail/emplace_args.hpp +++ b/include/boost/unordered/detail/emplace_args.hpp @@ -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::type + typename boost::unordered::detail::rv_ref::type #endif //////////////////////////////////////////////////////////////////////////// + // Construct from tuple // - // Value Construction + // Used for piecewise construction. #define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \ template \ @@ -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 struct emulation1 { @@ -216,328 +231,185 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) }; #endif + template + struct check3_base { + static choice1::type check(choice1, + boost::unordered::piecewise_construct_t); + #if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) - template - 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 - 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())) }; + }; + template struct piecewise3 { - enum { value = - sizeof(check3_base::check(choose(), make())) == - sizeof(choice1::type) }; + enum { value = check3_base::value == sizeof(choice1::type) }; }; +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) template struct emulation3 { - enum { value = - sizeof(check3_base::check(choose(), make())) == - sizeof(choice2::type) }; + enum { value = check3_base::value == sizeof(choice2::type) }; }; - template - struct normal3 { - enum { value = - sizeof(check3_base::check(choose(), make())) == - sizeof(choice3::type) }; - }; - - template - struct pair_construct1 {}; - template - struct normal_construct1 { typedef void type; }; - -#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) - template - struct pair_construct1, A0> - : enable_if, void> {}; - - template - struct normal_construct1, A0> - : disable_if, void> {}; #endif - template - struct piecewise_construct3 {}; - template - struct piecewise_construct3, A0> - : enable_if, void> {}; - - template - struct pair_construct3 {}; - template - struct pair_construct3, A0> - : enable_if, void> {}; - - template - struct normal_construct3 { typedef void type; }; - template - struct normal_construct3, A0> - : enable_if, void> {}; - - template - struct pair_construct_n {}; - template - struct normal_construct_n { typedef void type; }; - -#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) - template - struct pair_construct_n > { typedef void type; }; - template - struct normal_construct_n > {}; -#endif - - template - inline typename normal_construct1::type - construct_impl2(void* address, BOOST_FWD_REF(A0) a0) - { - new(address) T( - boost::forward(a0) - ); - } - #if defined(BOOST_UNORDERED_STD_FORWARD_MOVE) -//////////////////////////////////////////////////////////////////////////////// -// Construct from variadic parameters + //////////////////////////////////////////////////////////////////////////// + // Construct from variadic parameters - template - inline void construct_impl(void* address) + template + inline void construct_impl(T* address, Args&&... args) { - new(address) T(); + new((void*) address) T(std::forward(args)...); } - template - inline typename normal_construct1::type - construct_impl(void* address, A0&& a0) + template + inline typename enable_if, void>::type + construct_impl(std::pair* address, A0&&, A1&& a1, A2&& a2) { - new(address) T( - boost::forward(a0) - ); + construct_from_tuple( + boost::addressof(address->first), a1); + construct_from_tuple( + boost::addressof(address->second), a2); } - template - inline typename pair_construct1::type - construct_impl(void* address, A0&& a0) +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) + + template + inline typename enable_if, void>::type + construct_impl(std::pair* address, A0&& a0) { - new((void*)(&static_cast(address)->first)) - typename T::first_type( - boost::forward(a0)); - new((void*)(&static_cast(address)->second)) - typename T::second_type(); + new((void*) boost::addressof(address->first)) A(std::forward(a0)); + new((void*) boost::addressof(address->second)) B(); } - template - inline void construct_impl(void* address, A0&& a0, A1&& a1) + template + inline typename enable_if, void>::type + construct_impl(T* address, A0&& a0, A1&& a1, A2&& a2) { - new(address) T( - boost::forward(a0), - boost::forward(a1)); + new((void*) boost::addressof(address->first)) A(std::forward(a0)); + new((void*) boost::addressof(address->second)) B( + std::forward(a1), + std::forward(a2)); } - template - inline typename piecewise_construct3::type - construct_impl(void* address, A0&&, A1&& a1, A2&& a2) - { - construct_from_tuple( - boost::addressof(static_cast(address)->first), a1); - construct_from_tuple( - boost::addressof(static_cast(address)->second), a2); - } - - template - inline typename pair_construct3::type - construct_impl(void* address, A0&& a0, A1&& a1, A2&& a2) - { - new((void*)(&static_cast(address)->first)) - typename T::first_type( - boost::forward(a0)); - new((void*)(&static_cast(address)->second)) - typename T::second_type( - boost::forward(a1), - boost::forward(a2)); - } - - template - inline typename normal_construct3::type - construct_impl(void* address, A0&& a0, A1&& a1, A2&& a2) - { - new(address) T( - boost::forward(a0), - boost::forward(a1), - boost::forward(a2)); - } - - template - inline typename normal_construct_n::type - construct_impl(void* address, A0&& a0, A1&& a1, A2&& a2, - A3&& a3, Args&&... args) + inline void construct_impl(std::pair* address, + A0&& a0, A1&& a1, A2&& a2, A3&& a3, Args&&... args) { - new(address) T( - std::forward(a0), + new((void*) boost::addressof(address->first)) A(std::forward(a0)); + + new((void*) boost::addressof(address->second)) B( std::forward(a1), std::forward(a2), std::forward(a3), std::forward(args)...); } - template - inline typename pair_construct_n::type - construct_impl(void* address, A0&& a0, A1&& a1, A2&& a2, - A3&& a3, Args&&... args) - { - new((void*)(&static_cast(address)->first)) - typename T::first_type( - std::forward(a0)); - new((void*)(&static_cast(address)->second)) - typename T::second_type( - std::forward(a1), - std::forward(a2), - std::forward(a3), - std::forward(args)...); - } - -#else +#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT +#else // BOOST_UNORDERED_STD_FORWARD_MOVE //////////////////////////////////////////////////////////////////////////////// -// Construct with emplace_args - - template - inline typename normal_construct1::type - construct_impl(void* address, - ::boost::unordered::detail::emplace_args1 const& args) - { - new(address) T( - boost::forward(args.a0) - ); - } - - template - inline typename pair_construct1::type - construct_impl(void* address, A0 const& a0) - { - new((void*)(&static_cast(address)->first)) - typename T::first_type( - boost::forward(a0)); - new((void*)(&static_cast(address)->second)) - typename T::second_type(); - } - - template - inline typename pair_construct1::type - construct_impl(void* address, - ::boost::unordered::detail::emplace_args1 const& args) - { - new((void*)(&static_cast(address)->first)) - typename T::first_type( - boost::forward(args.a0)); - new((void*)(&static_cast(address)->second)) - typename T::second_type(); - } - - template - inline void construct_impl(void* address, - ::boost::unordered::detail::emplace_args2 const& args) - { - new(address) T( - boost::forward(args.a0), - boost::forward(args.a1)); - } - - template - inline typename piecewise_construct3::type - construct_impl(void* address, - ::boost::unordered::detail::emplace_args3 const& args) - { - construct_from_tuple( - boost::addressof(static_cast(address)->first), args.a1); - construct_from_tuple( - boost::addressof(static_cast(address)->second), args.a2); - } - - template - inline typename pair_construct3::type - construct_impl(void* address, - ::boost::unordered::detail::emplace_args3 const& args) - { - new((void*)(&static_cast(address)->first)) - typename T::first_type( - boost::forward(args.a0)); - new((void*)(&static_cast(address)->second)) - typename T::second_type( - boost::forward(args.a1), - boost::forward(args.a2)); - } - - template - inline typename normal_construct3::type - construct_impl(void* address, - ::boost::unordered::detail::emplace_args3 const& args) - { - new(address) T( - boost::forward(args.a0), - boost::forward(args.a1), - boost::forward(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::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 + inline typename enable_if, void>::type + construct_impl(std::pair* address, + boost::unordered::detail::emplace_args3 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 + inline typename enable_if, void>::type + construct_impl(std::pair* address, + boost::unordered::detail::emplace_args1 const& args) + { + new((void*) boost::addressof(address->first)) A( + boost::forward(args.a0)); + new((void*) boost::addressof(address->second)) B(); + } + + template + inline typename enable_if, void>::type + construct_impl(std::pair* address, + boost::unordered::detail::emplace_args3 const& args) + { + new((void*) boost::addressof(address->first)) A( + boost::forward(args.a0)); + new((void*) boost::addressof(address->second)) B( + boost::forward(args.a1), + boost::forward(args.a2)); + } + #define BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(z, num_params, _) \ - template \ - inline typename pair_construct_n::type \ - construct_impl(void* address, \ - ::boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \ + inline void construct_impl(std::pair* 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(address)->first)) \ - typename T::first_type( \ + new((void*) boost::addressof(address->first)) A( \ boost::forward(args.a0)); \ - new((void*)(&static_cast(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 + inline void construct_impl2(T* address, BOOST_FWD_REF(A0) a0) + { + new((void*) address) T( + boost::forward(a0) + ); + } }}} diff --git a/include/boost/unordered/detail/equivalent.hpp b/include/boost/unordered/detail/equivalent.hpp index 629b13c3..3594cfe7 100644 --- a/include/boost/unordered/detail/equivalent.hpp +++ b/include/boost/unordered/detail/equivalent.hpp @@ -23,7 +23,7 @@ namespace boost { namespace unordered { namespace detail { template struct grouped_node : - ::boost::unordered::detail::value_base + boost::unordered::detail::value_base { typedef VoidPointer link_pointer; @@ -45,10 +45,10 @@ namespace boost { namespace unordered { namespace detail { template struct grouped_ptr_node : - ::boost::unordered::detail::value_base, - ::boost::unordered::detail::ptr_bucket + boost::unordered::detail::value_base, + 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 struct pick_grouped_node2 { - typedef ::boost::unordered::detail::grouped_node node; + typedef boost::unordered::detail::grouped_node node; - typedef typename ::boost::unordered::detail::allocator_traits< - typename ::boost::unordered::detail::rebind_wrap::type + typedef typename boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap::type >::pointer node_pointer; - typedef ::boost::unordered::detail::bucket bucket; + typedef boost::unordered::detail::bucket bucket; typedef VoidPointer link_pointer; }; template struct pick_grouped_node2*, - ::boost::unordered::detail::ptr_bucket*> + boost::unordered::detail::grouped_ptr_node*, + boost::unordered::detail::ptr_bucket*> { - typedef ::boost::unordered::detail::grouped_ptr_node node; - typedef ::boost::unordered::detail::ptr_bucket bucket; + typedef boost::unordered::detail::grouped_ptr_node node; + typedef boost::unordered::detail::ptr_bucket bucket; typedef bucket* link_pointer; }; template struct pick_grouped_node { - typedef ::boost::unordered::detail::allocator_traits< - typename ::boost::unordered::detail::rebind_wrap >::type + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap >::type > tentative_node_traits; - typedef ::boost::unordered::detail::allocator_traits< - typename ::boost::unordered::detail::rebind_wrap::type + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap::type > tentative_bucket_traits; typedef pick_grouped_node2 traits; + typedef boost::unordered::detail::allocator_traits 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::node node; - typedef typename ::boost::unordered::detail::pick_grouped_node::bucket bucket; - typedef typename ::boost::unordered::detail::pick_grouped_node::link_pointer link_pointer; - typedef ::boost::unordered::detail::grouped_table_impl table; + typedef typename boost::unordered::detail::pick_grouped_node::node node; + typedef typename boost::unordered::detail::pick_grouped_node::bucket bucket; + typedef typename boost::unordered::detail::pick_grouped_node::link_pointer link_pointer; + typedef boost::unordered::detail::grouped_table_impl table; - typedef ::boost::unordered::detail::set_extractor extractor; + typedef boost::unordered::detail::set_extractor extractor; }; template @@ -147,22 +147,22 @@ namespace boost { namespace unordered { namespace detail { typedef P key_equal; typedef K key_type; - typedef ::boost::unordered::detail::allocator_traits traits; + typedef boost::unordered::detail::allocator_traits traits; typedef typename traits::value_type value_type; typedef typename traits::void_pointer void_pointer; - typedef typename ::boost::unordered::detail::pick_grouped_node::node node; - typedef typename ::boost::unordered::detail::pick_grouped_node::bucket bucket; - typedef typename ::boost::unordered::detail::pick_grouped_node::link_pointer link_pointer; - typedef ::boost::unordered::detail::grouped_table_impl table; + typedef typename boost::unordered::detail::pick_grouped_node::node node; + typedef typename boost::unordered::detail::pick_grouped_node::bucket bucket; + typedef typename boost::unordered::detail::pick_grouped_node::link_pointer link_pointer; + typedef boost::unordered::detail::grouped_table_impl table; - typedef ::boost::unordered::detail::map_extractor extractor; + typedef boost::unordered::detail::map_extractor extractor; }; template - struct grouped_table_impl : ::boost::unordered::detail::table + struct grouped_table_impl : boost::unordered::detail::table { - typedef ::boost::unordered::detail::table table; + typedef boost::unordered::detail::table 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 - typename ::boost::unordered::detail::enable_if_forward::type + typename boost::unordered::detail::enable_if_forward::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 - typename ::boost::unordered::detail::disable_if_forward::type + typename boost::unordered::detail::disable_if_forward::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(begin->group_prev_); if(prev->next_ != static_cast(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) { diff --git a/include/boost/unordered/detail/extract_key.hpp b/include/boost/unordered/detail/extract_key.hpp index dc9e70f8..55fe61ed 100644 --- a/include/boost/unordered/detail/extract_key.hpp +++ b/include/boost/unordered/detail/extract_key.hpp @@ -93,7 +93,7 @@ namespace detail { struct map_extractor { typedef ValueType value_type; - typedef typename ::boost::remove_const::type key_type; + typedef typename boost::remove_const::type key_type; static key_type const& extract(value_type const& v) { diff --git a/include/boost/unordered/detail/table.hpp b/include/boost/unordered/detail/table.hpp index 25db5c6f..2683bace 100644 --- a/include/boost/unordered/detail/table.hpp +++ b/include/boost/unordered/detail/table.hpp @@ -32,13 +32,13 @@ namespace boost { namespace unordered { namespace iterator_detail { template 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 - 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 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 ; private: @@ -142,13 +142,13 @@ namespace boost { namespace unordered { namespace iterator_detail { template 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 - 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 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; + friend struct boost::unordered::iterator_detail::iterator; #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template - friend class ::boost::unordered::unordered_map; + friend class boost::unordered::unordered_map; template - friend class ::boost::unordered::unordered_multimap; + friend class boost::unordered::unordered_multimap; template - friend class ::boost::unordered::unordered_set; + friend class boost::unordered::unordered_set; template - 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 data_; + boost::alignment_of::value>::type data_; void* address() { return this; @@ -286,11 +286,11 @@ namespace boost { namespace unordered { namespace detail { template 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 iterator; - typedef ::boost::unordered::iterator_detail::c_iterator c_iterator; - typedef ::boost::unordered::iterator_detail::l_iterator l_iterator; - typedef ::boost::unordered::iterator_detail::cl_iterator cl_iterator; + typedef boost::unordered::iterator_detail::iterator iterator; + typedef boost::unordered::iterator_detail::c_iterator c_iterator; + typedef boost::unordered::iterator_detail::l_iterator l_iterator; + typedef boost::unordered::iterator_detail::cl_iterator 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(this->mlf_) * static_cast(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(this->mlf_) * static_cast(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(size) / static_cast(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:: 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:: 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(this->size_) / static_cast(mlf_))) + 1)); diff --git a/include/boost/unordered/detail/unique.hpp b/include/boost/unordered/detail/unique.hpp index fa56592a..efceaa6b 100644 --- a/include/boost/unordered/detail/unique.hpp +++ b/include/boost/unordered/detail/unique.hpp @@ -25,7 +25,7 @@ namespace boost { namespace unordered { namespace detail { template struct node : - ::boost::unordered::detail::value_base + boost::unordered::detail::value_base { typedef VoidPointer link_pointer; @@ -44,10 +44,10 @@ namespace boost { namespace unordered { namespace detail { template struct ptr_node : - ::boost::unordered::detail::value_base, - ::boost::unordered::detail::ptr_bucket + boost::unordered::detail::value_base, + 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 struct pick_node2 { - typedef ::boost::unordered::detail::node node; + typedef boost::unordered::detail::node node; - typedef typename ::boost::unordered::detail::allocator_traits< - typename ::boost::unordered::detail::rebind_wrap::type + typedef typename boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap::type >::pointer node_pointer; - typedef ::boost::unordered::detail::bucket bucket; + typedef boost::unordered::detail::bucket bucket; typedef VoidPointer link_pointer; }; template struct pick_node2*, - ::boost::unordered::detail::ptr_bucket*> + boost::unordered::detail::ptr_node*, + boost::unordered::detail::ptr_bucket*> { - typedef ::boost::unordered::detail::ptr_node node; - typedef ::boost::unordered::detail::ptr_bucket bucket; + typedef boost::unordered::detail::ptr_node node; + typedef boost::unordered::detail::ptr_bucket bucket; typedef bucket* link_pointer; }; template struct pick_node { - typedef ::boost::unordered::detail::allocator_traits< - typename ::boost::unordered::detail::rebind_wrap >::type + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap >::type > tentative_node_traits; - typedef ::boost::unordered::detail::allocator_traits< - typename ::boost::unordered::detail::rebind_wrap::type + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap::type > tentative_bucket_traits; typedef pick_node2 traits; + typedef boost::unordered::detail::allocator_traits 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::node node; - typedef typename ::boost::unordered::detail::pick_node::bucket bucket; - typedef typename ::boost::unordered::detail::pick_node::link_pointer link_pointer; - typedef ::boost::unordered::detail::table_impl table; + typedef typename boost::unordered::detail::pick_node::node node; + typedef typename boost::unordered::detail::pick_node::bucket bucket; + typedef typename boost::unordered::detail::pick_node::link_pointer link_pointer; + typedef boost::unordered::detail::table_impl table; - typedef ::boost::unordered::detail::set_extractor extractor; + typedef boost::unordered::detail::set_extractor extractor; }; template @@ -143,22 +143,22 @@ namespace boost { namespace unordered { namespace detail { typedef P key_equal; typedef K key_type; - typedef ::boost::unordered::detail::allocator_traits traits; + typedef boost::unordered::detail::allocator_traits traits; typedef typename traits::value_type value_type; typedef typename traits::void_pointer void_pointer; - typedef typename ::boost::unordered::detail::pick_node::node node; - typedef typename ::boost::unordered::detail::pick_node::bucket bucket; - typedef typename ::boost::unordered::detail::pick_node::link_pointer link_pointer; - typedef ::boost::unordered::detail::table_impl table; + typedef typename boost::unordered::detail::pick_node::node node; + typedef typename boost::unordered::detail::pick_node::bucket bucket; + typedef typename boost::unordered::detail::pick_node::link_pointer link_pointer; + typedef boost::unordered::detail::table_impl table; - typedef ::boost::unordered::detail::map_extractor extractor; + typedef boost::unordered::detail::map_extractor extractor; }; template - struct table_impl : ::boost::unordered::detail::table + struct table_impl : boost::unordered::detail::table { - typedef ::boost::unordered::detail::table table; + typedef boost::unordered::detail::table 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); diff --git a/include/boost/unordered/detail/util.hpp b/include/boost/unordered/detail/util.hpp index 250b7808..28b1e95f 100644 --- a/include/boost/unordered/detail/util.hpp +++ b/include/boost/unordered/detail/util.hpp @@ -33,22 +33,22 @@ namespace boost { namespace unordered { namespace detail { template struct is_forward : - ::boost::is_convertible< - typename ::boost::iterator_traversal::type, - ::boost::forward_traversal_tag> + boost::is_convertible< + typename boost::iterator_traversal::type, + boost::forward_traversal_tag> {}; template struct enable_if_forward : - ::boost::enable_if_c< - ::boost::unordered::detail::is_forward::value, + boost::enable_if_c< + boost::unordered::detail::is_forward::value, ReturnType> {}; template struct disable_if_forward : - ::boost::disable_if_c< - ::boost::unordered::detail::is_forward::value, + boost::disable_if_c< + boost::unordered::detail::is_forward::value, ReturnType> {}; @@ -135,7 +135,7 @@ namespace boost { namespace unordered { namespace detail { template inline typename - ::boost::unordered::detail::enable_if_forward::type + boost::unordered::detail::enable_if_forward::type insert_size(I i, I j) { return std::distance(i, j); @@ -143,7 +143,7 @@ namespace boost { namespace unordered { namespace detail { template inline typename - ::boost::unordered::detail::disable_if_forward::type + boost::unordered::detail::disable_if_forward::type insert_size(I, I) { return 1; @@ -151,11 +151,11 @@ namespace boost { namespace unordered { namespace detail { template 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); } diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 7335c0d7..738ce1b2 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -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 + typedef boost::unordered::detail::allocator_traits allocator_traits; - typedef ::boost::unordered::detail::map + typedef boost::unordered::detail::map 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, - 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 + typedef boost::unordered::detail::allocator_traits allocator_traits; - typedef ::boost::unordered::detail::multimap + typedef boost::unordered::detail::multimap 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, - 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 unordered_map::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 template unordered_map::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 unordered_map::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 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 unordered_multimap::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 template unordered_multimap::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 unordered_multimap::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 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) { diff --git a/include/boost/unordered/unordered_map_fwd.hpp b/include/boost/unordered/unordered_map_fwd.hpp index 4700d589..91f1e3bd 100644 --- a/include/boost/unordered/unordered_map_fwd.hpp +++ b/include/boost/unordered/unordered_map_fwd.hpp @@ -37,11 +37,11 @@ namespace boost unordered_multimap&); } - 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 diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index 34cc2da7..72026ad5 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -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 + typedef boost::unordered::detail::allocator_traits allocator_traits; - typedef ::boost::unordered::detail::set + typedef boost::unordered::detail::set 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, - 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 + typedef boost::unordered::detail::allocator_traits allocator_traits; - typedef ::boost::unordered::detail::multiset + typedef boost::unordered::detail::multiset 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, - 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 unordered_set::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 template unordered_set::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 unordered_set::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 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 unordered_multiset::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 template unordered_multiset::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 unordered_multiset::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 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) { diff --git a/include/boost/unordered/unordered_set_fwd.hpp b/include/boost/unordered/unordered_set_fwd.hpp index 1935bc5d..f19c137d 100644 --- a/include/boost/unordered/unordered_set_fwd.hpp +++ b/include/boost/unordered/unordered_set_fwd.hpp @@ -37,11 +37,11 @@ namespace boost unordered_multiset &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