forked from boostorg/container
Refactor node implemenations from 3 (slist_node, list_node and tree_node) to a single base_node:
- To avoid unneeded includes, is_pair is factored out from pair.hpp implementation - Fixed bug where value_types inside nodes were not allocator-ware destructed. - Changed scoped utilities to handle new clases
This commit is contained in:
@@ -69,61 +69,8 @@ struct list_hook
|
||||
};
|
||||
|
||||
template <class T, class VoidPointer>
|
||||
struct list_node
|
||||
: public list_hook<VoidPointer>::type
|
||||
struct iiterator_node_value_type< base_node<T, list_hook<VoidPointer> > >
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T internal_type;
|
||||
typedef typename list_hook<VoidPointer>::type hook_type;
|
||||
|
||||
typedef typename dtl::aligned_storage<sizeof(T), dtl::alignment_of<T>::value>::type storage_t;
|
||||
storage_t m_storage;
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) && (BOOST_GCC < 80000)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#define BOOST_CONTAINER_DISABLE_ALIASING_WARNING
|
||||
# endif
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T &get_data()
|
||||
{ return *move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T &get_data() const
|
||||
{ return *move_detail::force_ptr<const T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T *get_data_ptr()
|
||||
{ return move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T *get_data_ptr() const
|
||||
{ return move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type &get_real_data()
|
||||
{ return *move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type &get_real_data() const
|
||||
{ return *move_detail::force_ptr<const internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type *get_real_data_ptr()
|
||||
{ return move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type *get_real_data_ptr() const
|
||||
{ return move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE ~list_node()
|
||||
{ move_detail::force_ptr<T*>(this->m_storage.data)->~T(); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DISABLE_ALIASING_WARNING)
|
||||
#pragma GCC diagnostic pop
|
||||
#undef BOOST_CONTAINER_DISABLE_ALIASING_WARNING
|
||||
# endif
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void destroy_header()
|
||||
{ static_cast<hook_type*>(this)->~hook_type(); }
|
||||
};
|
||||
|
||||
template <class T, class VoidPointer>
|
||||
struct iiterator_node_value_type< list_node<T,VoidPointer> > {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
@@ -136,8 +83,7 @@ struct intrusive_list_type
|
||||
<typename allocator_traits_type::pointer>::template
|
||||
rebind_pointer<void>::type
|
||||
void_pointer;
|
||||
typedef typename dtl::list_node
|
||||
<value_type, void_pointer> node_type;
|
||||
typedef base_node<value_type, list_hook<void_pointer> > node_type;
|
||||
typedef typename dtl::bi::make_list
|
||||
< node_type
|
||||
, dtl::bi::base_hook<typename list_hook<void_pointer>::type>
|
||||
@@ -184,7 +130,7 @@ class list
|
||||
typedef typename AllocHolder::NodeAlloc NodeAlloc;
|
||||
typedef typename AllocHolder::ValAlloc ValAlloc;
|
||||
typedef typename AllocHolder::Node Node;
|
||||
typedef dtl::allocator_destroyer<NodeAlloc> Destroyer;
|
||||
typedef dtl::allocator_node_destroyer<NodeAlloc> Destroyer;
|
||||
typedef typename AllocHolder::alloc_version alloc_version;
|
||||
typedef boost::container::allocator_traits<ValueAllocator> allocator_traits_type;
|
||||
typedef boost::container::equal_to_value
|
||||
@@ -1495,17 +1441,13 @@ class list
|
||||
return iterator(this->icont().insert(p.get(), *tmp));
|
||||
}
|
||||
|
||||
void priv_push_back (const T &x)
|
||||
{ this->insert(this->cend(), x); }
|
||||
template<class U>
|
||||
void priv_push_back(BOOST_FWD_REF(U) x)
|
||||
{ this->icont().push_back(*this->create_node(::boost::forward<U>(x))); }
|
||||
|
||||
void priv_push_back (BOOST_RV_REF(T) x)
|
||||
{ this->insert(this->cend(), boost::move(x)); }
|
||||
|
||||
void priv_push_front (const T &x)
|
||||
{ this->insert(this->cbegin(), x); }
|
||||
|
||||
void priv_push_front (BOOST_RV_REF(T) x)
|
||||
{ this->insert(this->cbegin(), boost::move(x)); }
|
||||
template<class U>
|
||||
void priv_push_front(BOOST_FWD_REF(U) x)
|
||||
{ this->icont().push_front(*this->create_node(::boost::forward<U>(x))); }
|
||||
|
||||
class insertion_functor;
|
||||
friend class insertion_functor;
|
||||
|
||||
Reference in New Issue
Block a user