mirror of
https://github.com/boostorg/container.git
synced 2026-05-05 02:04:11 +02:00
Fixes for scoped_allocator
[SVN r78148]
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/container/detail/value_init.hpp>
|
||||
#include <boost/container/detail/destroyers.hpp>
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/aligned_storage.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -173,6 +175,10 @@ class flat_tree
|
||||
//!Standard extension
|
||||
typedef allocator_type stored_allocator_type;
|
||||
|
||||
private:
|
||||
typedef allocator_traits<stored_allocator_type> stored_allocator_traits;
|
||||
|
||||
public:
|
||||
flat_tree()
|
||||
: m_data()
|
||||
{ }
|
||||
@@ -377,44 +383,65 @@ class flat_tree
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> emplace_unique(Args&&... args)
|
||||
{
|
||||
value_type && val = value_type(boost::forward<Args>(args)...);
|
||||
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v;
|
||||
value_type &val = *static_cast<value_type *>(static_cast<void *>(&v));
|
||||
stored_allocator_type &a = this->get_stored_allocator();
|
||||
stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
|
||||
scoped_destructor<stored_allocator_type> d(a, &val);
|
||||
insert_commit_data data;
|
||||
std::pair<iterator,bool> ret =
|
||||
priv_insert_unique_prepare(val, data);
|
||||
if(ret.second){
|
||||
ret.first = priv_insert_commit(data, boost::move(val));
|
||||
}
|
||||
d.release();
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint_unique(const_iterator hint, Args&&... args)
|
||||
{
|
||||
value_type && val = value_type(boost::forward<Args>(args)...);
|
||||
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v;
|
||||
value_type &val = *static_cast<value_type *>(static_cast<void *>(&v));
|
||||
stored_allocator_type &a = this->get_stored_allocator();
|
||||
stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
|
||||
scoped_destructor<stored_allocator_type> d(a, &val);
|
||||
insert_commit_data data;
|
||||
std::pair<iterator,bool> ret = priv_insert_unique_prepare(hint, val, data);
|
||||
if(ret.second){
|
||||
ret.first = priv_insert_commit(data, boost::move(val));
|
||||
}
|
||||
d.release();
|
||||
return ret.first;
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_equal(Args&&... args)
|
||||
{
|
||||
value_type &&val = value_type(boost::forward<Args>(args)...);
|
||||
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v;
|
||||
value_type &val = *static_cast<value_type *>(static_cast<void *>(&v));
|
||||
stored_allocator_type &a = this->get_stored_allocator();
|
||||
stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
|
||||
scoped_destructor<stored_allocator_type> d(a, &val);
|
||||
iterator i = this->upper_bound(KeyOfValue()(val));
|
||||
i = this->m_data.m_vect.insert(i, boost::move(val));
|
||||
d.release();
|
||||
return i;
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint_equal(const_iterator hint, Args&&... args)
|
||||
{
|
||||
value_type &&val = value_type(boost::forward<Args>(args)...);
|
||||
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v;
|
||||
value_type &val = *static_cast<value_type *>(static_cast<void *>(&v));
|
||||
stored_allocator_type &a = this->get_stored_allocator();
|
||||
stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
|
||||
scoped_destructor<stored_allocator_type> d(a, &val);
|
||||
insert_commit_data data;
|
||||
this->priv_insert_equal_prepare(hint, val, data);
|
||||
return priv_insert_commit(data, boost::move(val));
|
||||
iterator i = priv_insert_commit(data, boost::move(val));
|
||||
d.release();
|
||||
return i;
|
||||
}
|
||||
|
||||
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
|
||||
@@ -424,15 +451,18 @@ class flat_tree
|
||||
std::pair<iterator, bool> \
|
||||
emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
|
||||
{ \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n) \
|
||||
BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
|
||||
value_type &val = vval; \
|
||||
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v; \
|
||||
value_type &val = *static_cast<value_type *>(static_cast<void *>(&v)); \
|
||||
stored_allocator_type &a = this->get_stored_allocator(); \
|
||||
stored_allocator_traits::construct(a, &val \
|
||||
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
|
||||
scoped_destructor<stored_allocator_type> d(a, &val); \
|
||||
insert_commit_data data; \
|
||||
std::pair<iterator,bool> ret = priv_insert_unique_prepare(val, data); \
|
||||
if(ret.second){ \
|
||||
ret.first = priv_insert_commit(data, boost::move(val)); \
|
||||
} \
|
||||
d.release(); \
|
||||
return ret; \
|
||||
} \
|
||||
\
|
||||
@@ -440,27 +470,33 @@ class flat_tree
|
||||
iterator emplace_hint_unique(const_iterator hint \
|
||||
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
|
||||
{ \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n) \
|
||||
BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
|
||||
value_type &val = vval; \
|
||||
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v; \
|
||||
value_type &val = *static_cast<value_type *>(static_cast<void *>(&v)); \
|
||||
stored_allocator_type &a = this->get_stored_allocator(); \
|
||||
stored_allocator_traits::construct(a, &val \
|
||||
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
|
||||
scoped_destructor<stored_allocator_type> d(a, &val); \
|
||||
insert_commit_data data; \
|
||||
std::pair<iterator,bool> ret = priv_insert_unique_prepare(hint, val, data); \
|
||||
if(ret.second){ \
|
||||
ret.first = priv_insert_commit(data, boost::move(val)); \
|
||||
} \
|
||||
d.release(); \
|
||||
return ret.first; \
|
||||
} \
|
||||
\
|
||||
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
|
||||
iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
|
||||
{ \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n) \
|
||||
BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
|
||||
value_type &val = vval; \
|
||||
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v; \
|
||||
value_type &val = *static_cast<value_type *>(static_cast<void *>(&v)); \
|
||||
stored_allocator_type &a = this->get_stored_allocator(); \
|
||||
stored_allocator_traits::construct(a, &val \
|
||||
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
|
||||
scoped_destructor<stored_allocator_type> d(a, &val); \
|
||||
iterator i = this->upper_bound(KeyOfValue()(val)); \
|
||||
i = this->m_data.m_vect.insert(i, boost::move(val)); \
|
||||
d.release(); \
|
||||
return i; \
|
||||
} \
|
||||
\
|
||||
@@ -468,14 +504,19 @@ class flat_tree
|
||||
iterator emplace_hint_equal(const_iterator hint \
|
||||
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
|
||||
{ \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n) \
|
||||
BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n); \
|
||||
value_type &val = vval; \
|
||||
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v; \
|
||||
value_type &val = *static_cast<value_type *>(static_cast<void *>(&v)); \
|
||||
stored_allocator_type &a = this->get_stored_allocator(); \
|
||||
stored_allocator_traits::construct(a, &val \
|
||||
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
|
||||
scoped_destructor<stored_allocator_type> d(a, &val); \
|
||||
insert_commit_data data; \
|
||||
this->priv_insert_equal_prepare(hint, val, data); \
|
||||
return priv_insert_commit(data, boost::move(val)); \
|
||||
iterator i = priv_insert_commit(data, boost::move(val)); \
|
||||
d.release(); \
|
||||
return i; \
|
||||
} \
|
||||
|
||||
//!
|
||||
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
@@ -300,14 +300,6 @@ class flat_map
|
||||
const_iterator begin() const
|
||||
{ return container_detail::force<const_iterator>(m_flat_tree.begin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const
|
||||
{ return container_detail::force<const_iterator>(m_flat_tree.cbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the end of the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -324,14 +316,6 @@ class flat_map
|
||||
const_iterator end() const
|
||||
{ return container_detail::force<const_iterator>(m_flat_tree.end()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const
|
||||
{ return container_detail::force<const_iterator>(m_flat_tree.cend()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed container.
|
||||
//!
|
||||
@@ -350,15 +334,6 @@ class flat_map
|
||||
const_reverse_iterator rbegin() const
|
||||
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.rbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.crbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
|
||||
//! of the reversed container.
|
||||
//!
|
||||
@@ -377,6 +352,31 @@ class flat_map
|
||||
const_reverse_iterator rend() const
|
||||
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.rend()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const
|
||||
{ return container_detail::force<const_iterator>(m_flat_tree.cbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const
|
||||
{ return container_detail::force<const_iterator>(m_flat_tree.cend()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.crbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed container.
|
||||
//!
|
||||
@@ -1119,6 +1119,40 @@ class flat_multimap
|
||||
const_reverse_iterator rend() const
|
||||
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.rend()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const
|
||||
{ return container_detail::force<const_iterator>(m_flat_tree.cbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const
|
||||
{ return container_detail::force<const_iterator>(m_flat_tree.cend()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.crbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crend() const
|
||||
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.crend()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if the container contains no elements.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
|
||||
@@ -65,6 +65,10 @@ template <class T, class VoidPointer>
|
||||
struct list_node
|
||||
: public list_hook<VoidPointer>::type
|
||||
{
|
||||
private:
|
||||
list_node();
|
||||
|
||||
public:
|
||||
typedef typename list_hook<VoidPointer>::type hook_type;
|
||||
T m_data;
|
||||
};
|
||||
|
||||
@@ -276,6 +276,14 @@ class map
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator begin() const
|
||||
{ return this->cbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const
|
||||
{ return m_tree.begin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the end of the container.
|
||||
@@ -292,6 +300,14 @@ class map
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator end() const
|
||||
{ return this->cend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const
|
||||
{ return m_tree.end(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
@@ -310,6 +326,15 @@ class map
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rbegin() const
|
||||
{ return this->crbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return m_tree.rbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
|
||||
@@ -328,6 +353,15 @@ class map
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rend() const
|
||||
{ return this->crend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crend() const
|
||||
{ return m_tree.rend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if the container contains no elements.
|
||||
@@ -984,6 +1018,14 @@ class multimap
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator begin() const
|
||||
{ return this->cbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const
|
||||
{ return m_tree.begin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the end of the container.
|
||||
@@ -1000,6 +1042,14 @@ class multimap
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator end() const
|
||||
{ return this->cend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const
|
||||
{ return m_tree.end(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
@@ -1018,6 +1068,15 @@ class multimap
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rbegin() const
|
||||
{ return this->crbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return m_tree.rbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
|
||||
@@ -1036,6 +1095,15 @@ class multimap
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rend() const
|
||||
{ return this->crend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crend() const
|
||||
{ return m_tree.rend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if the container contains no elements.
|
||||
|
||||
@@ -674,6 +674,20 @@ class scoped_allocator_adaptor_base
|
||||
, inner(other.inner_allocator())
|
||||
{}
|
||||
|
||||
protected:
|
||||
struct internal_type_t{};
|
||||
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor_base
|
||||
( internal_type_t
|
||||
, BOOST_FWD_REF(OuterA2) outerAlloc
|
||||
, const inner_allocator_type &inner)
|
||||
: outer_allocator_type(::boost::forward<OuterA2>(outerAlloc))
|
||||
, m_inner(inner)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
scoped_allocator_adaptor_base &operator=
|
||||
(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
|
||||
{
|
||||
@@ -772,17 +786,17 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
|
||||
scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc \
|
||||
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _)) \
|
||||
: outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) \
|
||||
, inner(BOOST_PP_ENUM_PARAMS(n, q)) \
|
||||
, m_inner(BOOST_PP_ENUM_PARAMS(n, q)) \
|
||||
{} \
|
||||
\
|
||||
scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) \
|
||||
: outer_allocator_type(other.outer_allocator()) \
|
||||
, inner(other.inner_allocator()) \
|
||||
, m_inner(other.inner_allocator()) \
|
||||
{} \
|
||||
\
|
||||
scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) \
|
||||
: outer_allocator_type(::boost::move(other.outer_allocator())) \
|
||||
, inner(::boost::move(other.inner_allocator())) \
|
||||
, m_inner(::boost::move(other.inner_allocator())) \
|
||||
{} \
|
||||
\
|
||||
template <class OuterA2> \
|
||||
@@ -793,7 +807,7 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
|
||||
, BOOST_CONTAINER_PP_IDENTITY, nat) \
|
||||
>& other) \
|
||||
: outer_allocator_type(other.outer_allocator()) \
|
||||
, inner(other.inner_allocator()) \
|
||||
, m_inner(other.inner_allocator()) \
|
||||
{} \
|
||||
\
|
||||
template <class OuterA2> \
|
||||
@@ -805,29 +819,42 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
|
||||
, BOOST_CONTAINER_PP_IDENTITY, nat) \
|
||||
> BOOST_RV_REF_END other) \
|
||||
: outer_allocator_type(other.outer_allocator()) \
|
||||
, inner(other.inner_allocator()) \
|
||||
, m_inner(other.inner_allocator()) \
|
||||
{} \
|
||||
\
|
||||
protected: \
|
||||
struct internal_type_t{}; \
|
||||
\
|
||||
template <class OuterA2> \
|
||||
scoped_allocator_adaptor_base \
|
||||
( internal_type_t \
|
||||
, BOOST_FWD_REF(OuterA2) outerAlloc \
|
||||
, const inner_allocator_type &inner) \
|
||||
: outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) \
|
||||
, m_inner(inner) \
|
||||
{} \
|
||||
\
|
||||
public: \
|
||||
scoped_allocator_adaptor_base &operator= \
|
||||
(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) \
|
||||
{ \
|
||||
outer_allocator_type::operator=(other.outer_allocator()); \
|
||||
inner = other.inner_allocator(); \
|
||||
m_inner = other.inner_allocator(); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) \
|
||||
{ \
|
||||
outer_allocator_type::operator=(boost::move(other.outer_allocator())); \
|
||||
inner = ::boost::move(other.inner_allocator()); \
|
||||
m_inner = ::boost::move(other.inner_allocator()); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
inner_allocator_type& inner_allocator() \
|
||||
{ return inner; } \
|
||||
{ return m_inner; } \
|
||||
\
|
||||
inner_allocator_type const& inner_allocator() const \
|
||||
{ return inner; } \
|
||||
{ return m_inner; } \
|
||||
\
|
||||
outer_allocator_type & outer_allocator() \
|
||||
{ return static_cast<outer_allocator_type&>(*this); } \
|
||||
@@ -836,7 +863,7 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
|
||||
{ return static_cast<const outer_allocator_type&>(*this); } \
|
||||
\
|
||||
private: \
|
||||
inner_allocator_type inner; \
|
||||
inner_allocator_type m_inner; \
|
||||
}; \
|
||||
//!
|
||||
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
|
||||
@@ -920,6 +947,15 @@ class scoped_allocator_adaptor_base
|
||||
: outer_allocator_type(other.outer_allocator())
|
||||
{}
|
||||
|
||||
protected:
|
||||
struct internal_type_t{};
|
||||
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &)
|
||||
: outer_allocator_type(::boost::forward<OuterA2>(outerAlloc))
|
||||
{}
|
||||
|
||||
public:
|
||||
scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
|
||||
{
|
||||
outer_allocator_type::operator=(other.outer_allocator());
|
||||
@@ -1221,8 +1257,9 @@ class scoped_allocator_adaptor
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const
|
||||
{
|
||||
return scoped_allocator_adaptor
|
||||
(outer_traits_type::select_on_container_copy_construction(this->outer_allocator()),
|
||||
outer_traits_type::select_on_container_copy_construction(this->inner_allocator())
|
||||
(internal_type_t()
|
||||
,outer_traits_type::select_on_container_copy_construction(this->outer_allocator())
|
||||
,outer_traits_type::select_on_container_copy_construction(this->inner_allocator())
|
||||
);
|
||||
}
|
||||
/// @cond
|
||||
@@ -1309,11 +1346,11 @@ class scoped_allocator_adaptor
|
||||
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(std::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
|
||||
{ this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<U>(y)); }
|
||||
{ this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); }
|
||||
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(container_detail::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
|
||||
{ this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<U>(y)); }
|
||||
{ this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); }
|
||||
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(std::pair<T1, T2>* p, const std::pair<U, V>& x)
|
||||
@@ -1391,6 +1428,12 @@ class scoped_allocator_adaptor
|
||||
//template <class T1, class T2, class... Args1, class... Args2>
|
||||
//void construct(pair<T1, T2>* p, piecewise_construct_t, tuple<Args1...> x, tuple<Args2...> y);
|
||||
|
||||
private:
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner)
|
||||
: base_type(internal_type_t(), ::boost::forward<OuterA2>(outer), inner)
|
||||
{}
|
||||
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
|
||||
@@ -65,6 +65,10 @@ template <class T, class VoidPointer>
|
||||
struct slist_node
|
||||
: public slist_hook<VoidPointer>::type
|
||||
{
|
||||
private:
|
||||
slist_node();
|
||||
|
||||
public:
|
||||
typedef typename slist_hook<VoidPointer>::type hook_type;
|
||||
T m_data;
|
||||
};
|
||||
|
||||
@@ -119,6 +119,10 @@ template<typename VoidPointer, typename T>
|
||||
struct node_type
|
||||
: public node_type_base<VoidPointer>
|
||||
{
|
||||
private:
|
||||
node_type();
|
||||
|
||||
public:
|
||||
T value;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user