From 0d1cfba823b4780879d3e2dbb8720cefbfc87714 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 22 Oct 2016 10:28:53 +0100 Subject: [PATCH] Rename functions in allocate.hpp --- include/boost/unordered/detail/allocate.hpp | 40 +++++++++---------- include/boost/unordered/detail/buckets.hpp | 2 +- include/boost/unordered/detail/equivalent.hpp | 18 ++++----- include/boost/unordered/detail/table.hpp | 2 +- include/boost/unordered/detail/unique.hpp | 14 +++---- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/include/boost/unordered/detail/allocate.hpp b/include/boost/unordered/detail/allocate.hpp index 137214d4..bddfaf4f 100644 --- a/include/boost/unordered/detail/allocate.hpp +++ b/include/boost/unordered/detail/allocate.hpp @@ -917,7 +917,7 @@ namespace boost { namespace unordered { namespace detail { namespace func { } template - inline void destroy_value_impl(Alloc& alloc, T* x) { + inline void call_destroy(Alloc& alloc, T* x) { boost::unordered::detail::allocator_traits::destroy(alloc, x); } @@ -932,7 +932,7 @@ namespace boost { namespace unordered { namespace detail { namespace func { } template - inline void destroy_value_impl(Alloc&, T* x) { + inline void call_destroy(Alloc&, T* x) { boost::unordered::detail::func::destroy(x); } @@ -954,7 +954,7 @@ namespace boost { namespace unordered { namespace detail { namespace func { } template - inline void destroy_value_impl(Alloc&, T* x) { + inline void call_destroy(Alloc&, T* x) { boost::unordered::detail::func::destroy(x); } @@ -1095,7 +1095,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) // For the standard pair constructor. template - inline void construct_value_impl(Alloc& alloc, T* address, + inline void construct_from_args(Alloc& alloc, T* address, BOOST_FWD_REF(Args)... args) { boost::unordered::detail::func::call_construct(alloc, @@ -1110,7 +1110,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) template inline typename enable_if, void>::type - construct_value_impl(Alloc& alloc, std::pair* address, + construct_from_args(Alloc& alloc, std::pair* address, BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) { boost::unordered::detail::func::construct_from_tuple(alloc, @@ -1125,21 +1125,21 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) #else // BOOST_NO_CXX11_VARIADIC_TEMPLATES -//////////////////////////////////////////////////////////////////////////////// -// Construct from emplace_args + //////////////////////////////////////////////////////////////////////////// + // Construct from emplace_args // Explicitly write out first three overloads for the sake of sane // error messages. template - inline void construct_value_impl(Alloc&, T* address, + inline void construct_from_args(Alloc&, T* address, emplace_args1 const& args) { new((void*) address) T(boost::forward(args.a0)); } template - inline void construct_value_impl(Alloc&, T* address, + inline void construct_from_args(Alloc&, T* address, emplace_args2 const& args) { new((void*) address) T( @@ -1149,7 +1149,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) } template - inline void construct_value_impl(Alloc&, T* address, + inline void construct_from_args(Alloc&, T* address, emplace_args3 const& args) { new((void*) address) T( @@ -1166,7 +1166,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) typename Alloc, typename T, \ BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \ > \ - inline void construct_value_impl(Alloc&, T* address, \ + inline void construct_from_args(Alloc&, T* address, \ boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \ BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \ > const& args) \ @@ -1185,7 +1185,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) template - inline void construct_value_impl(Alloc& alloc, std::pair* address, + inline void construct_from_args(Alloc& alloc, std::pair* address, boost::unordered::detail::emplace_args3 const& args, typename enable_if, void*>::type = 0) { @@ -1247,7 +1247,7 @@ namespace boost { namespace unordered { namespace detail { BOOST_ASSERT(!node_); node_ = p; node_constructed_ = true; - boost::unordered::detail::func::destroy_value_impl(alloc_, + boost::unordered::detail::func::call_destroy(alloc_, node_->value_ptr()); } @@ -1313,7 +1313,7 @@ namespace boost { namespace unordered { namespace detail { node_tmp::~node_tmp() { if (node_) { - boost::unordered::detail::func::destroy_value_impl(alloc_, + boost::unordered::detail::func::call_destroy(alloc_, node_->value_ptr()); boost::unordered::detail::func::destroy( boost::addressof(*node_)); @@ -1324,23 +1324,23 @@ namespace boost { namespace unordered { namespace detail { namespace boost { namespace unordered { namespace detail { namespace func { - // Some nicer construct_value functions, might try to + // Some nicer construct_node functions, might try to // improve implementation later. template inline typename boost::unordered::detail::allocator_traits::pointer - construct_value_generic(Alloc& alloc, BOOST_UNORDERED_EMPLACE_ARGS) + construct_node_from_args(Alloc& alloc, BOOST_UNORDERED_EMPLACE_ARGS) { node_constructor a(alloc); a.create_node(); - construct_value_impl(alloc, a.node_->value_ptr(), + construct_from_args(alloc, a.node_->value_ptr(), BOOST_UNORDERED_EMPLACE_FORWARD); return a.release(); } template inline typename boost::unordered::detail::allocator_traits::pointer - construct_value(Alloc& alloc, BOOST_FWD_REF(U) x) + construct_node(Alloc& alloc, BOOST_FWD_REF(U) x) { node_constructor a(alloc); a.create_node(); @@ -1353,7 +1353,7 @@ namespace boost { namespace unordered { namespace detail { namespace func { // constructor for std::piece_construct with std::tuple. template inline typename boost::unordered::detail::allocator_traits::pointer - construct_pair(Alloc& alloc, BOOST_FWD_REF(Key) k) + construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k) { node_constructor a(alloc); a.create_node(); @@ -1369,7 +1369,7 @@ namespace boost { namespace unordered { namespace detail { namespace func { template inline typename boost::unordered::detail::allocator_traits::pointer - construct_pair(Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m) + construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m) { node_constructor a(alloc); a.create_node(); diff --git a/include/boost/unordered/detail/buckets.hpp b/include/boost/unordered/detail/buckets.hpp index b857bfd6..bd9a5cbb 100644 --- a/include/boost/unordered/detail/buckets.hpp +++ b/include/boost/unordered/detail/buckets.hpp @@ -391,7 +391,7 @@ namespace boost { namespace unordered { namespace detail { node_pointer p = nodes_; nodes_ = static_cast(p->next_); - boost::unordered::detail::func::destroy_value_impl(constructor_.alloc_, + boost::unordered::detail::func::call_destroy(constructor_.alloc_, p->value_ptr()); boost::unordered::detail::func::destroy(boost::addressof(*p)); node_allocator_traits::deallocate(constructor_.alloc_, p, 1); diff --git a/include/boost/unordered/detail/equivalent.hpp b/include/boost/unordered/detail/equivalent.hpp index 5a71181e..618d3af9 100644 --- a/include/boost/unordered/detail/equivalent.hpp +++ b/include/boost/unordered/detail/equivalent.hpp @@ -442,7 +442,7 @@ namespace boost { namespace unordered { namespace detail { iterator emplace(BOOST_UNORDERED_EMPLACE_ARGS) { return iterator(emplace_impl( - boost::unordered::detail::func::construct_value_generic( + boost::unordered::detail::func::construct_node_from_args( this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD))); } @@ -450,7 +450,7 @@ namespace boost { namespace unordered { namespace detail { iterator emplace_hint(c_iterator hint, BOOST_UNORDERED_EMPLACE_ARGS) { return iterator(emplace_hint_impl(hint, - boost::unordered::detail::func::construct_value_generic( + boost::unordered::detail::func::construct_node_from_args( this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD))); } @@ -503,7 +503,7 @@ namespace boost { namespace unordered { namespace detail { std::size_t distance = static_cast(std::distance(i, j)); if(distance == 1) { emplace_impl( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), *i)); } else { @@ -512,7 +512,7 @@ namespace boost { namespace unordered { namespace detail { for (; i != j; ++i) { emplace_impl_no_rehash( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), *i)); } } @@ -524,7 +524,7 @@ namespace boost { namespace unordered { namespace detail { { for (; i != j; ++i) { emplace_impl( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), *i)); } } @@ -644,12 +644,12 @@ namespace boost { namespace unordered { namespace detail { std::size_t key_hash = n->hash_; node_pointer group_end(next_group(n)); node_pointer pos = this->add_node( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), n->value()), key_hash, node_pointer()); for (n = next_node(n); n != group_end; n = next_node(n)) { this->add_node( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), n->value()), key_hash, pos); } } @@ -662,12 +662,12 @@ namespace boost { namespace unordered { namespace detail { std::size_t key_hash = n->hash_; node_pointer group_end(next_group(n)); node_pointer pos = this->add_node( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), boost::move(n->value())), key_hash, node_pointer()); for (n = next_node(n); n != group_end; n = next_node(n)) { this->add_node( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), boost::move(n->value())), key_hash, pos); } } diff --git a/include/boost/unordered/detail/table.hpp b/include/boost/unordered/detail/table.hpp index 65c06908..9657c763 100644 --- a/include/boost/unordered/detail/table.hpp +++ b/include/boost/unordered/detail/table.hpp @@ -464,7 +464,7 @@ namespace boost { namespace unordered { namespace detail { node_pointer n = static_cast(prev->next_); prev->next_ = n->next_; - boost::unordered::detail::func::destroy_value_impl(node_alloc(), + boost::unordered::detail::func::call_destroy(node_alloc(), n->value_ptr()); boost::unordered::detail::func::destroy(boost::addressof(*n)); node_allocator_traits::deallocate(node_alloc(), n, 1); diff --git a/include/boost/unordered/detail/unique.hpp b/include/boost/unordered/detail/unique.hpp index c736456b..e77b4c14 100644 --- a/include/boost/unordered/detail/unique.hpp +++ b/include/boost/unordered/detail/unique.hpp @@ -313,7 +313,7 @@ namespace boost { namespace unordered { namespace detail { } else { return this->resize_and_add_node( - boost::unordered::detail::func::construct_pair(this->node_alloc(), k), + boost::unordered::detail::func::construct_node_pair(this->node_alloc(), k), key_hash)->value(); } } @@ -420,7 +420,7 @@ namespace boost { namespace unordered { namespace detail { else { return emplace_return( iterator(this->resize_and_add_node( - boost::unordered::detail::func::construct_value_generic( + boost::unordered::detail::func::construct_node_from_args( this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD), key_hash)), true); @@ -432,7 +432,7 @@ namespace boost { namespace unordered { namespace detail { BOOST_UNORDERED_EMPLACE_ARGS) { node_tmp b( - boost::unordered::detail::func::construct_value_generic( + boost::unordered::detail::func::construct_node_from_args( this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD), this->node_alloc()); key_type const& k = this->get_key(b.node_->value()); @@ -453,7 +453,7 @@ namespace boost { namespace unordered { namespace detail { emplace_return emplace_impl(no_key, BOOST_UNORDERED_EMPLACE_ARGS) { node_tmp b( - boost::unordered::detail::func::construct_value_generic( + boost::unordered::detail::func::construct_node_from_args( this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD), this->node_alloc()); key_type const& k = this->get_key(b.node_->value()); @@ -509,7 +509,7 @@ namespace boost { namespace unordered { namespace detail { if (!pos) { node_tmp b( - boost::unordered::detail::func::construct_value(this->node_alloc(), *i), + boost::unordered::detail::func::construct_node(this->node_alloc(), *i), this->node_alloc()); if(this->size_ + 1 > this->max_load_) this->reserve_for_insert(this->size_ + @@ -617,7 +617,7 @@ namespace boost { namespace unordered { namespace detail { for(node_pointer n = src.begin(); n; n = next_node(n)) { this->add_node( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), n->value()), n->hash_); } } @@ -627,7 +627,7 @@ namespace boost { namespace unordered { namespace detail { for(node_pointer n = src.begin(); n; n = next_node(n)) { this->add_node( - boost::unordered::detail::func::construct_value( + boost::unordered::detail::func::construct_node( this->node_alloc(), boost::move(n->value())), n->hash_); } }