Rename functions in allocate.hpp

This commit is contained in:
Daniel James
2016-10-22 10:28:53 +01:00
parent e986b70981
commit 0d1cfba823
5 changed files with 38 additions and 38 deletions

View File

@ -917,7 +917,7 @@ namespace boost { namespace unordered { namespace detail { namespace func {
} }
template <typename Alloc, typename T> template <typename Alloc, typename T>
inline void destroy_value_impl(Alloc& alloc, T* x) { inline void call_destroy(Alloc& alloc, T* x) {
boost::unordered::detail::allocator_traits<Alloc>::destroy(alloc, x); boost::unordered::detail::allocator_traits<Alloc>::destroy(alloc, x);
} }
@ -932,7 +932,7 @@ namespace boost { namespace unordered { namespace detail { namespace func {
} }
template <typename Alloc, typename T> template <typename Alloc, typename T>
inline void destroy_value_impl(Alloc&, T* x) { inline void call_destroy(Alloc&, T* x) {
boost::unordered::detail::func::destroy(x); boost::unordered::detail::func::destroy(x);
} }
@ -954,7 +954,7 @@ namespace boost { namespace unordered { namespace detail { namespace func {
} }
template <typename Alloc, typename T> template <typename Alloc, typename T>
inline void destroy_value_impl(Alloc&, T* x) { inline void call_destroy(Alloc&, T* x) {
boost::unordered::detail::func::destroy(x); boost::unordered::detail::func::destroy(x);
} }
@ -1095,7 +1095,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
// For the standard pair constructor. // For the standard pair constructor.
template <typename Alloc, typename T, typename... Args> template <typename Alloc, typename T, typename... Args>
inline void construct_value_impl(Alloc& alloc, T* address, inline void construct_from_args(Alloc& alloc, T* address,
BOOST_FWD_REF(Args)... args) BOOST_FWD_REF(Args)... args)
{ {
boost::unordered::detail::func::call_construct(alloc, boost::unordered::detail::func::call_construct(alloc,
@ -1110,7 +1110,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
template <typename Alloc, typename A, typename B, template <typename Alloc, typename A, typename B,
typename A0, typename A1, typename A2> typename A0, typename A1, typename A2>
inline typename enable_if<use_piecewise<A0>, void>::type inline typename enable_if<use_piecewise<A0>, void>::type
construct_value_impl(Alloc& alloc, std::pair<A, B>* address, construct_from_args(Alloc& alloc, std::pair<A, B>* address,
BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
{ {
boost::unordered::detail::func::construct_from_tuple(alloc, 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 #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 // Explicitly write out first three overloads for the sake of sane
// error messages. // error messages.
template <typename Alloc, typename T, typename A0> template <typename Alloc, typename T, typename A0>
inline void construct_value_impl(Alloc&, T* address, inline void construct_from_args(Alloc&, T* address,
emplace_args1<A0> const& args) emplace_args1<A0> const& args)
{ {
new((void*) address) T(boost::forward<A0>(args.a0)); new((void*) address) T(boost::forward<A0>(args.a0));
} }
template <typename Alloc, typename T, typename A0, typename A1> template <typename Alloc, typename T, typename A0, typename A1>
inline void construct_value_impl(Alloc&, T* address, inline void construct_from_args(Alloc&, T* address,
emplace_args2<A0, A1> const& args) emplace_args2<A0, A1> const& args)
{ {
new((void*) address) T( new((void*) address) T(
@ -1149,7 +1149,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
} }
template <typename Alloc, typename T, typename A0, typename A1, typename A2> template <typename Alloc, typename T, typename A0, typename A1, typename A2>
inline void construct_value_impl(Alloc&, T* address, inline void construct_from_args(Alloc&, T* address,
emplace_args3<A0, A1, A2> const& args) emplace_args3<A0, A1, A2> const& args)
{ {
new((void*) address) T( new((void*) address) T(
@ -1166,7 +1166,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
typename Alloc, typename T, \ typename Alloc, typename T, \
BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \ 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::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \
BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \ BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \
> const& args) \ > const& args) \
@ -1185,7 +1185,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
template <typename Alloc, typename A, typename B, template <typename Alloc, typename A, typename B,
typename A0, typename A1, typename A2> typename A0, typename A1, typename A2>
inline void construct_value_impl(Alloc& alloc, std::pair<A, B>* address, inline void construct_from_args(Alloc& alloc, std::pair<A, B>* address,
boost::unordered::detail::emplace_args3<A0, A1, A2> const& args, boost::unordered::detail::emplace_args3<A0, A1, A2> const& args,
typename enable_if<use_piecewise<A0>, void*>::type = 0) typename enable_if<use_piecewise<A0>, void*>::type = 0)
{ {
@ -1247,7 +1247,7 @@ namespace boost { namespace unordered { namespace detail {
BOOST_ASSERT(!node_); BOOST_ASSERT(!node_);
node_ = p; node_ = p;
node_constructed_ = true; node_constructed_ = true;
boost::unordered::detail::func::destroy_value_impl(alloc_, boost::unordered::detail::func::call_destroy(alloc_,
node_->value_ptr()); node_->value_ptr());
} }
@ -1313,7 +1313,7 @@ namespace boost { namespace unordered { namespace detail {
node_tmp<Alloc>::~node_tmp() node_tmp<Alloc>::~node_tmp()
{ {
if (node_) { if (node_) {
boost::unordered::detail::func::destroy_value_impl(alloc_, boost::unordered::detail::func::call_destroy(alloc_,
node_->value_ptr()); node_->value_ptr());
boost::unordered::detail::func::destroy( boost::unordered::detail::func::destroy(
boost::addressof(*node_)); boost::addressof(*node_));
@ -1324,23 +1324,23 @@ namespace boost { namespace unordered { namespace detail {
namespace boost { namespace unordered { namespace detail { namespace func { 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. // improve implementation later.
template <typename Alloc, BOOST_UNORDERED_EMPLACE_TEMPLATE> template <typename Alloc, BOOST_UNORDERED_EMPLACE_TEMPLATE>
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
construct_value_generic(Alloc& alloc, BOOST_UNORDERED_EMPLACE_ARGS) construct_node_from_args(Alloc& alloc, BOOST_UNORDERED_EMPLACE_ARGS)
{ {
node_constructor<Alloc> a(alloc); node_constructor<Alloc> a(alloc);
a.create_node(); a.create_node();
construct_value_impl(alloc, a.node_->value_ptr(), construct_from_args(alloc, a.node_->value_ptr(),
BOOST_UNORDERED_EMPLACE_FORWARD); BOOST_UNORDERED_EMPLACE_FORWARD);
return a.release(); return a.release();
} }
template <typename Alloc, typename U> template <typename Alloc, typename U>
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
construct_value(Alloc& alloc, BOOST_FWD_REF(U) x) construct_node(Alloc& alloc, BOOST_FWD_REF(U) x)
{ {
node_constructor<Alloc> a(alloc); node_constructor<Alloc> a(alloc);
a.create_node(); a.create_node();
@ -1353,7 +1353,7 @@ namespace boost { namespace unordered { namespace detail { namespace func {
// constructor for std::piece_construct with std::tuple. // constructor for std::piece_construct with std::tuple.
template <typename Alloc, typename Key> template <typename Alloc, typename Key>
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
construct_pair(Alloc& alloc, BOOST_FWD_REF(Key) k) construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k)
{ {
node_constructor<Alloc> a(alloc); node_constructor<Alloc> a(alloc);
a.create_node(); a.create_node();
@ -1369,7 +1369,7 @@ namespace boost { namespace unordered { namespace detail { namespace func {
template <typename Alloc, typename Key, typename Mapped> template <typename Alloc, typename Key, typename Mapped>
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer inline typename boost::unordered::detail::allocator_traits<Alloc>::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<Alloc> a(alloc); node_constructor<Alloc> a(alloc);
a.create_node(); a.create_node();

View File

@ -391,7 +391,7 @@ namespace boost { namespace unordered { namespace detail {
node_pointer p = nodes_; node_pointer p = nodes_;
nodes_ = static_cast<node_pointer>(p->next_); nodes_ = static_cast<node_pointer>(p->next_);
boost::unordered::detail::func::destroy_value_impl(constructor_.alloc_, boost::unordered::detail::func::call_destroy(constructor_.alloc_,
p->value_ptr()); p->value_ptr());
boost::unordered::detail::func::destroy(boost::addressof(*p)); boost::unordered::detail::func::destroy(boost::addressof(*p));
node_allocator_traits::deallocate(constructor_.alloc_, p, 1); node_allocator_traits::deallocate(constructor_.alloc_, p, 1);

View File

@ -442,7 +442,7 @@ namespace boost { namespace unordered { namespace detail {
iterator emplace(BOOST_UNORDERED_EMPLACE_ARGS) iterator emplace(BOOST_UNORDERED_EMPLACE_ARGS)
{ {
return iterator(emplace_impl( 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))); 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) iterator emplace_hint(c_iterator hint, BOOST_UNORDERED_EMPLACE_ARGS)
{ {
return iterator(emplace_hint_impl(hint, 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))); this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD)));
} }
@ -503,7 +503,7 @@ namespace boost { namespace unordered { namespace detail {
std::size_t distance = static_cast<std::size_t>(std::distance(i, j)); std::size_t distance = static_cast<std::size_t>(std::distance(i, j));
if(distance == 1) { if(distance == 1) {
emplace_impl( emplace_impl(
boost::unordered::detail::func::construct_value( boost::unordered::detail::func::construct_node(
this->node_alloc(), *i)); this->node_alloc(), *i));
} }
else { else {
@ -512,7 +512,7 @@ namespace boost { namespace unordered { namespace detail {
for (; i != j; ++i) { for (; i != j; ++i) {
emplace_impl_no_rehash( emplace_impl_no_rehash(
boost::unordered::detail::func::construct_value( boost::unordered::detail::func::construct_node(
this->node_alloc(), *i)); this->node_alloc(), *i));
} }
} }
@ -524,7 +524,7 @@ namespace boost { namespace unordered { namespace detail {
{ {
for (; i != j; ++i) { for (; i != j; ++i) {
emplace_impl( emplace_impl(
boost::unordered::detail::func::construct_value( boost::unordered::detail::func::construct_node(
this->node_alloc(), *i)); this->node_alloc(), *i));
} }
} }
@ -644,12 +644,12 @@ namespace boost { namespace unordered { namespace detail {
std::size_t key_hash = n->hash_; std::size_t key_hash = n->hash_;
node_pointer group_end(next_group(n)); node_pointer group_end(next_group(n));
node_pointer pos = this->add_node( 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()); this->node_alloc(), n->value()), key_hash, node_pointer());
for (n = next_node(n); n != group_end; n = next_node(n)) for (n = next_node(n); n != group_end; n = next_node(n))
{ {
this->add_node( this->add_node(
boost::unordered::detail::func::construct_value( boost::unordered::detail::func::construct_node(
this->node_alloc(), n->value()), key_hash, pos); 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_; std::size_t key_hash = n->hash_;
node_pointer group_end(next_group(n)); node_pointer group_end(next_group(n));
node_pointer pos = this->add_node( 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()); this->node_alloc(), boost::move(n->value())), key_hash, node_pointer());
for (n = next_node(n); n != group_end; n = next_node(n)) for (n = next_node(n); n != group_end; n = next_node(n))
{ {
this->add_node( 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); this->node_alloc(), boost::move(n->value())), key_hash, pos);
} }
} }

View File

@ -464,7 +464,7 @@ namespace boost { namespace unordered { namespace detail {
node_pointer n = static_cast<node_pointer>(prev->next_); node_pointer n = static_cast<node_pointer>(prev->next_);
prev->next_ = n->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()); n->value_ptr());
boost::unordered::detail::func::destroy(boost::addressof(*n)); boost::unordered::detail::func::destroy(boost::addressof(*n));
node_allocator_traits::deallocate(node_alloc(), n, 1); node_allocator_traits::deallocate(node_alloc(), n, 1);

View File

@ -313,7 +313,7 @@ namespace boost { namespace unordered { namespace detail {
} }
else { else {
return this->resize_and_add_node( 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(); key_hash)->value();
} }
} }
@ -420,7 +420,7 @@ namespace boost { namespace unordered { namespace detail {
else { else {
return emplace_return( return emplace_return(
iterator(this->resize_and_add_node( 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), this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD),
key_hash)), key_hash)),
true); true);
@ -432,7 +432,7 @@ namespace boost { namespace unordered { namespace detail {
BOOST_UNORDERED_EMPLACE_ARGS) BOOST_UNORDERED_EMPLACE_ARGS)
{ {
node_tmp b( 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(), BOOST_UNORDERED_EMPLACE_FORWARD),
this->node_alloc()); this->node_alloc());
key_type const& k = this->get_key(b.node_->value()); 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) emplace_return emplace_impl(no_key, BOOST_UNORDERED_EMPLACE_ARGS)
{ {
node_tmp b( 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(), BOOST_UNORDERED_EMPLACE_FORWARD),
this->node_alloc()); this->node_alloc());
key_type const& k = this->get_key(b.node_->value()); key_type const& k = this->get_key(b.node_->value());
@ -509,7 +509,7 @@ namespace boost { namespace unordered { namespace detail {
if (!pos) { if (!pos) {
node_tmp b( 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()); this->node_alloc());
if(this->size_ + 1 > this->max_load_) if(this->size_ + 1 > this->max_load_)
this->reserve_for_insert(this->size_ + 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)) { for(node_pointer n = src.begin(); n; n = next_node(n)) {
this->add_node( this->add_node(
boost::unordered::detail::func::construct_value( boost::unordered::detail::func::construct_node(
this->node_alloc(), n->value()), n->hash_); 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)) { for(node_pointer n = src.begin(); n; n = next_node(n)) {
this->add_node( this->add_node(
boost::unordered::detail::func::construct_value( boost::unordered::detail::func::construct_node(
this->node_alloc(), boost::move(n->value())), n->hash_); this->node_alloc(), boost::move(n->value())), n->hash_);
} }
} }