forked from boostorg/unordered
Unordered: Go back to the old method for constructing nodes.
Reverts much of [78349]. Keeps the variadic construct. [SVN r80219]
This commit is contained in:
1 parent
2e11fd8a86
commit
ff31c73970
4 files changed
+43
-211
No files matched your search
@@ -1104,76 +1104,6 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// construct_node/destroy_node
|
||||
//
|
||||
// Construct a node using the best available method.
|
||||
|
||||
#if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT
|
||||
|
||||
template <typename Alloc, typename T, BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
||||
inline void construct_node(Alloc& a, T* p, BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
{
|
||||
boost::unordered::detail::allocator_traits<Alloc>::construct(
|
||||
a, p, BOOST_UNORDERED_EMPLACE_FORWARD);
|
||||
}
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
inline void destroy_node(Alloc& a, T* p)
|
||||
{
|
||||
boost::unordered::detail::allocator_traits<Alloc>::destroy(a, p);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <typename AllocTraits, typename T>
|
||||
struct value_construct
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME AllocTraits::allocator_type allocator;
|
||||
|
||||
allocator& alloc;
|
||||
T* ptr;
|
||||
|
||||
value_construct(allocator& a, T* p) : alloc(a), ptr(p)
|
||||
{
|
||||
AllocTraits::construct(alloc, ptr, T());
|
||||
}
|
||||
|
||||
void release()
|
||||
{
|
||||
ptr = 0;
|
||||
}
|
||||
|
||||
~value_construct()
|
||||
{
|
||||
if (ptr) AllocTraits::destroy(alloc, ptr);
|
||||
}
|
||||
|
||||
private:
|
||||
value_construct(value_construct const&);
|
||||
value_construct& operator=(value_construct const&);
|
||||
};
|
||||
|
||||
template <typename Alloc, typename T, BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
||||
inline void construct_node(Alloc& a, T* p, BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
{
|
||||
value_construct<boost::unordered::detail::allocator_traits<Alloc>, T>
|
||||
construct_guard(a, p);
|
||||
boost::unordered::detail::construct_impl(
|
||||
p->value_ptr(), BOOST_UNORDERED_EMPLACE_FORWARD);
|
||||
construct_guard.release();
|
||||
}
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
inline void destroy_node(Alloc& a, T* p)
|
||||
{
|
||||
boost::unordered::detail::destroy(p->value_ptr());
|
||||
boost::unordered::detail::allocator_traits<Alloc>::destroy(a, p);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// array_constructor
|
||||
|
||||
Reference in new issue
Block a user