mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 14:34:27 +02:00
@@ -718,9 +718,10 @@ use [*Boost.Container]? There are several reasons for that:
|
|||||||
|
|
||||||
* Implemented [link container.main_features.scary_iterators SCARY iterators].
|
* Implemented [link container.main_features.scary_iterators SCARY iterators].
|
||||||
|
|
||||||
* Fixed bugs [@https://svn.boost.org/trac/boost/ticket/8892 #8892],
|
* Fixed bugs [@https://svn.boost.org/trac/boost/ticket/8269 #8269],
|
||||||
[@https://svn.boost.org/trac/boost/ticket/8473 #8473],
|
[@https://svn.boost.org/trac/boost/ticket/8473 #8473],
|
||||||
[@https://svn.boost.org/trac/boost/ticket/8269 #8269].
|
[@https://svn.boost.org/trac/boost/ticket/8892 #8892],
|
||||||
|
[@https://svn.boost.org/trac/boost/ticket/9064 #9064].
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
@@ -736,7 +736,6 @@ class deque : protected deque_base<Allocator>
|
|||||||
}
|
}
|
||||||
//If unequal allocators, then do a one by one move
|
//If unequal allocators, then do a one by one move
|
||||||
else{
|
else{
|
||||||
typedef typename std::iterator_traits<iterator>::iterator_category ItCat;
|
|
||||||
this->assign( boost::make_move_iterator(x.begin())
|
this->assign( boost::make_move_iterator(x.begin())
|
||||||
, boost::make_move_iterator(x.end()));
|
, boost::make_move_iterator(x.end()));
|
||||||
}
|
}
|
||||||
|
@@ -585,6 +585,8 @@ class scoped_allocator_adaptor_base
|
|||||||
typedef OuterAlloc outer_allocator_type;
|
typedef OuterAlloc outer_allocator_type;
|
||||||
typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type;
|
typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type;
|
||||||
typedef allocator_traits<inner_allocator_type> inner_traits_type;
|
typedef allocator_traits<inner_allocator_type> inner_traits_type;
|
||||||
|
typedef scoped_allocator_adaptor
|
||||||
|
<OuterAlloc, InnerAllocs...> scoped_allocator_type;
|
||||||
typedef boost::integral_constant<
|
typedef boost::integral_constant<
|
||||||
bool,
|
bool,
|
||||||
outer_traits_type::propagate_on_container_copy_assignment::value ||
|
outer_traits_type::propagate_on_container_copy_assignment::value ||
|
||||||
@@ -635,7 +637,7 @@ class scoped_allocator_adaptor_base
|
|||||||
, m_inner(other.inner_allocator())
|
, m_inner(other.inner_allocator())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
struct internal_type_t{};
|
struct internal_type_t{};
|
||||||
|
|
||||||
template <class OuterA2>
|
template <class OuterA2>
|
||||||
@@ -670,6 +672,9 @@ class scoped_allocator_adaptor_base
|
|||||||
boost::container::swap_dispatch(this->m_inner, r.inner_allocator());
|
boost::container::swap_dispatch(this->m_inner, r.inner_allocator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r)
|
||||||
|
{ l.swap(r); }
|
||||||
|
|
||||||
inner_allocator_type& inner_allocator()
|
inner_allocator_type& inner_allocator()
|
||||||
{ return m_inner; }
|
{ return m_inner; }
|
||||||
|
|
||||||
@@ -682,6 +687,15 @@ class scoped_allocator_adaptor_base
|
|||||||
const outer_allocator_type &outer_allocator() const
|
const outer_allocator_type &outer_allocator() const
|
||||||
{ return static_cast<const outer_allocator_type&>(*this); }
|
{ return static_cast<const outer_allocator_type&>(*this); }
|
||||||
|
|
||||||
|
scoped_allocator_type select_on_container_copy_construction() const
|
||||||
|
{
|
||||||
|
return scoped_allocator_type
|
||||||
|
(internal_type_t()
|
||||||
|
,outer_traits_type::select_on_container_copy_construction(this->outer_allocator())
|
||||||
|
,inner_traits_type::select_on_container_copy_construction(this->inner_allocator())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inner_allocator_type m_inner;
|
inner_allocator_type m_inner;
|
||||||
};
|
};
|
||||||
@@ -730,6 +744,11 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
|
|||||||
( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \
|
( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \
|
||||||
, BOOST_CONTAINER_PP_IDENTITY, nat) \
|
, BOOST_CONTAINER_PP_IDENTITY, nat) \
|
||||||
> inner_allocator_type; \
|
> inner_allocator_type; \
|
||||||
|
typedef scoped_allocator_adaptor<OuterAlloc, BOOST_PP_ENUM_PARAMS(n, Q) \
|
||||||
|
BOOST_PP_ENUM_TRAILING \
|
||||||
|
( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \
|
||||||
|
, BOOST_CONTAINER_PP_IDENTITY, nat) \
|
||||||
|
> scoped_allocator_type; \
|
||||||
typedef allocator_traits<inner_allocator_type> inner_traits_type; \
|
typedef allocator_traits<inner_allocator_type> inner_traits_type; \
|
||||||
typedef boost::integral_constant< \
|
typedef boost::integral_constant< \
|
||||||
bool, \
|
bool, \
|
||||||
@@ -790,7 +809,7 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
|
|||||||
, m_inner(other.inner_allocator()) \
|
, m_inner(other.inner_allocator()) \
|
||||||
{} \
|
{} \
|
||||||
\
|
\
|
||||||
protected: \
|
public: \
|
||||||
struct internal_type_t{}; \
|
struct internal_type_t{}; \
|
||||||
\
|
\
|
||||||
template <class OuterA2> \
|
template <class OuterA2> \
|
||||||
@@ -824,6 +843,9 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
|
|||||||
boost::container::swap_dispatch(this->m_inner, r.inner_allocator()); \
|
boost::container::swap_dispatch(this->m_inner, r.inner_allocator()); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r) \
|
||||||
|
{ l.swap(r); } \
|
||||||
|
\
|
||||||
inner_allocator_type& inner_allocator() \
|
inner_allocator_type& inner_allocator() \
|
||||||
{ return m_inner; } \
|
{ return m_inner; } \
|
||||||
\
|
\
|
||||||
@@ -836,6 +858,14 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
|
|||||||
const outer_allocator_type &outer_allocator() const \
|
const outer_allocator_type &outer_allocator() const \
|
||||||
{ return static_cast<const outer_allocator_type&>(*this); } \
|
{ return static_cast<const outer_allocator_type&>(*this); } \
|
||||||
\
|
\
|
||||||
|
scoped_allocator_type select_on_container_copy_construction() const \
|
||||||
|
{ \
|
||||||
|
return scoped_allocator_type \
|
||||||
|
(internal_type_t() \
|
||||||
|
,outer_traits_type::select_on_container_copy_construction(this->outer_allocator()) \
|
||||||
|
,inner_traits_type::select_on_container_copy_construction(this->inner_allocator()) \
|
||||||
|
); \
|
||||||
|
} \
|
||||||
private: \
|
private: \
|
||||||
inner_allocator_type m_inner; \
|
inner_allocator_type m_inner; \
|
||||||
}; \
|
}; \
|
||||||
@@ -874,6 +904,7 @@ class scoped_allocator_adaptor_base
|
|||||||
typedef OuterAlloc outer_allocator_type;
|
typedef OuterAlloc outer_allocator_type;
|
||||||
typedef allocator_traits<OuterAlloc> outer_traits_type;
|
typedef allocator_traits<OuterAlloc> outer_traits_type;
|
||||||
typedef scoped_allocator_adaptor<OuterAlloc> inner_allocator_type;
|
typedef scoped_allocator_adaptor<OuterAlloc> inner_allocator_type;
|
||||||
|
typedef inner_allocator_type scoped_allocator_type;
|
||||||
typedef allocator_traits<inner_allocator_type> inner_traits_type;
|
typedef allocator_traits<inner_allocator_type> inner_traits_type;
|
||||||
typedef typename outer_traits_type::
|
typedef typename outer_traits_type::
|
||||||
propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
|
propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
|
||||||
@@ -922,7 +953,7 @@ class scoped_allocator_adaptor_base
|
|||||||
: outer_allocator_type(other.outer_allocator())
|
: outer_allocator_type(other.outer_allocator())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
struct internal_type_t{};
|
struct internal_type_t{};
|
||||||
|
|
||||||
template <class OuterA2>
|
template <class OuterA2>
|
||||||
@@ -948,6 +979,9 @@ class scoped_allocator_adaptor_base
|
|||||||
boost::container::swap_dispatch(this->outer_allocator(), r.outer_allocator());
|
boost::container::swap_dispatch(this->outer_allocator(), r.outer_allocator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r)
|
||||||
|
{ l.swap(r); }
|
||||||
|
|
||||||
inner_allocator_type& inner_allocator()
|
inner_allocator_type& inner_allocator()
|
||||||
{ return static_cast<inner_allocator_type&>(*this); }
|
{ return static_cast<inner_allocator_type&>(*this); }
|
||||||
|
|
||||||
@@ -959,6 +993,17 @@ class scoped_allocator_adaptor_base
|
|||||||
|
|
||||||
const outer_allocator_type &outer_allocator() const
|
const outer_allocator_type &outer_allocator() const
|
||||||
{ return static_cast<const outer_allocator_type&>(*this); }
|
{ return static_cast<const outer_allocator_type&>(*this); }
|
||||||
|
|
||||||
|
scoped_allocator_type select_on_container_copy_construction() const
|
||||||
|
{
|
||||||
|
return scoped_allocator_type
|
||||||
|
(internal_type_t()
|
||||||
|
,outer_traits_type::select_on_container_copy_construction(this->outer_allocator())
|
||||||
|
//Don't use inner_traits_type::select_on_container_copy_construction(this->inner_allocator())
|
||||||
|
//as inner_allocator() is equal to *this and that would trigger an infinite loop
|
||||||
|
, this->inner_allocator()
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace container_detail {
|
} //namespace container_detail {
|
||||||
@@ -1164,48 +1209,37 @@ class scoped_allocator_adaptor
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other)
|
scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other)
|
||||||
{
|
{ return static_cast<scoped_allocator_adaptor&>(base_type::operator=(static_cast<const base_type &>(other))); }
|
||||||
base_type::operator=(static_cast<const base_type &>(other));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other)
|
scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other)
|
||||||
{
|
{ return static_cast<scoped_allocator_adaptor&>(base_type::operator=(boost::move(static_cast<base_type&>(other)))); }
|
||||||
base_type::operator=(boost::move(static_cast<scoped_allocator_adaptor&>(other)));
|
|
||||||
return *this;
|
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||||
}
|
//! <b>Effects</b>: swaps *this with r.
|
||||||
|
//!
|
||||||
|
void swap(scoped_allocator_adaptor &r);
|
||||||
|
|
||||||
//! <b>Effects</b>: swaps *this with r.
|
//! <b>Effects</b>: swaps *this with r.
|
||||||
//!
|
//!
|
||||||
void swap(scoped_allocator_adaptor &r)
|
friend void swap(scoped_allocator_adaptor &l, scoped_allocator_adaptor &r);
|
||||||
{
|
|
||||||
base_type::swap(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! <b>Effects</b>: swaps *this with r.
|
|
||||||
//!
|
|
||||||
friend void swap(scoped_allocator_adaptor &l, scoped_allocator_adaptor &r)
|
|
||||||
{ l.swap(r); }
|
|
||||||
|
|
||||||
//! <b>Returns</b>:
|
//! <b>Returns</b>:
|
||||||
//! `static_cast<OuterAlloc&>(*this)`.
|
//! `static_cast<OuterAlloc&>(*this)`.
|
||||||
outer_allocator_type & outer_allocator()
|
outer_allocator_type & outer_allocator();
|
||||||
{ return *this; }
|
|
||||||
|
|
||||||
//! <b>Returns</b>:
|
//! <b>Returns</b>:
|
||||||
//! `static_cast<const OuterAlloc&>(*this)`.
|
//! `static_cast<const OuterAlloc&>(*this)`.
|
||||||
const outer_allocator_type &outer_allocator() const
|
const outer_allocator_type &outer_allocator() const;
|
||||||
{ return *this; }
|
|
||||||
|
|
||||||
//! <b>Returns</b>:
|
//! <b>Returns</b>:
|
||||||
//! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
|
//! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
|
||||||
inner_allocator_type& inner_allocator()
|
inner_allocator_type& inner_allocator();
|
||||||
{ return base_type::inner_allocator(); }
|
|
||||||
|
|
||||||
//! <b>Returns</b>:
|
//! <b>Returns</b>:
|
||||||
//! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
|
//! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
|
||||||
inner_allocator_type const& inner_allocator() const
|
inner_allocator_type const& inner_allocator() const;
|
||||||
{ return base_type::inner_allocator(); }
|
|
||||||
|
#endif //BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||||
|
|
||||||
//! <b>Returns</b>:
|
//! <b>Returns</b>:
|
||||||
//! `allocator_traits<OuterAlloc>::max_size(outer_allocator())`.
|
//! `allocator_traits<OuterAlloc>::max_size(outer_allocator())`.
|
||||||
@@ -1244,18 +1278,14 @@ class scoped_allocator_adaptor
|
|||||||
outer_traits_type::deallocate(this->outer_allocator(), p, n);
|
outer_traits_type::deallocate(this->outer_allocator(), p, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||||
//! <b>Returns</b>: Allocator new scoped_allocator_adaptor object where each allocator
|
//! <b>Returns</b>: Allocator new scoped_allocator_adaptor object where each allocator
|
||||||
//! A in the adaptor is initialized from the result of calling
|
//! A in the adaptor is initialized from the result of calling
|
||||||
//! `allocator_traits<Allocator>::select_on_container_copy_construction()` on
|
//! `allocator_traits<Allocator>::select_on_container_copy_construction()` on
|
||||||
//! the corresponding allocator in *this.
|
//! the corresponding allocator in *this.
|
||||||
scoped_allocator_adaptor select_on_container_copy_construction() const
|
scoped_allocator_adaptor select_on_container_copy_construction() const;
|
||||||
{
|
#endif //BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||||
return scoped_allocator_adaptor
|
|
||||||
(internal_type_t()
|
|
||||||
,outer_traits_type::select_on_container_copy_construction(this->outer_allocator())
|
|
||||||
,inner_traits_type::select_on_container_copy_construction(this->inner_allocator())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/// @cond
|
/// @cond
|
||||||
base_type &base() { return *this; }
|
base_type &base() { return *this; }
|
||||||
|
|
||||||
@@ -1426,7 +1456,8 @@ class scoped_allocator_adaptor
|
|||||||
//template <class T1, class T2, class... Args1, class... Args2>
|
//template <class T1, class T2, class... Args1, class... Args2>
|
||||||
//void construct(pair<T1, T2>* p, piecewise_construct_t, tuple<Args1...> x, tuple<Args2...> y);
|
//void construct(pair<T1, T2>* p, piecewise_construct_t, tuple<Args1...> x, tuple<Args2...> y);
|
||||||
|
|
||||||
private:
|
public:
|
||||||
|
//Internal function
|
||||||
template <class OuterA2>
|
template <class OuterA2>
|
||||||
scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner)
|
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)
|
: base_type(internal_type_t(), ::boost::forward<OuterA2>(outer), inner)
|
||||||
|
@@ -36,16 +36,20 @@ class test_allocator
|
|||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
|
|
||||||
test_allocator()
|
test_allocator()
|
||||||
|
: m_move_contructed(false), m_move_assigned(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
test_allocator(const test_allocator&)
|
test_allocator(const test_allocator&)
|
||||||
|
: m_move_contructed(false), m_move_assigned(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
test_allocator(BOOST_RV_REF(test_allocator) )
|
test_allocator(BOOST_RV_REF(test_allocator) )
|
||||||
|
: m_move_contructed(true), m_move_assigned(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
test_allocator(BOOST_RV_REF_BEG test_allocator<U, Id, Propagate> BOOST_RV_REF_END)
|
test_allocator(BOOST_RV_REF_BEG test_allocator<U, Id, Propagate> BOOST_RV_REF_END)
|
||||||
|
: m_move_contructed(true), m_move_assigned(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
@@ -53,10 +57,15 @@ class test_allocator
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
test_allocator & operator=(BOOST_COPY_ASSIGN_REF(test_allocator))
|
test_allocator & operator=(BOOST_COPY_ASSIGN_REF(test_allocator))
|
||||||
{ return *this; }
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
test_allocator & operator=(BOOST_RV_REF(test_allocator))
|
test_allocator & operator=(BOOST_RV_REF(test_allocator))
|
||||||
{ return *this; }
|
{
|
||||||
|
m_move_assigned = true;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t max_size() const
|
std::size_t max_size() const
|
||||||
{ return std::size_t(Id); }
|
{ return std::size_t(Id); }
|
||||||
@@ -66,6 +75,9 @@ class test_allocator
|
|||||||
|
|
||||||
void deallocate(T*p, std::size_t)
|
void deallocate(T*p, std::size_t)
|
||||||
{ delete []static_cast<char*>(static_cast<void*>(p)); }
|
{ delete []static_cast<char*>(static_cast<void*>(p)); }
|
||||||
|
|
||||||
|
bool m_move_contructed;
|
||||||
|
bool m_move_assigned;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T1, class T2, unsigned int Id, bool Propagate>
|
template <class T1, class T2, unsigned int Id, bool Propagate>
|
||||||
@@ -252,7 +264,6 @@ int main()
|
|||||||
typedef test_allocator<tagged_integer<1>, 1> InnerAlloc1;
|
typedef test_allocator<tagged_integer<1>, 1> InnerAlloc1;
|
||||||
typedef test_allocator<tagged_integer<2>, 2> InnerAlloc2;
|
typedef test_allocator<tagged_integer<2>, 2> InnerAlloc2;
|
||||||
typedef test_allocator<tagged_integer<1>, 11> Inner11IdAlloc1;
|
typedef test_allocator<tagged_integer<1>, 11> Inner11IdAlloc1;
|
||||||
typedef test_allocator<tagged_integer<1>, 12> Inner12IdAlloc2;
|
|
||||||
|
|
||||||
typedef test_allocator<tagged_integer<0>, 0, false> OuterAllocFalsePropagate;
|
typedef test_allocator<tagged_integer<0>, 0, false> OuterAllocFalsePropagate;
|
||||||
typedef test_allocator<tagged_integer<0>, 0, true> OuterAllocTruePropagate;
|
typedef test_allocator<tagged_integer<0>, 0, true> OuterAllocTruePropagate;
|
||||||
@@ -277,11 +288,6 @@ int main()
|
|||||||
<Outer10IdAlloc, Inner11IdAlloc1>
|
<Outer10IdAlloc, Inner11IdAlloc1>
|
||||||
, InnerAlloc1
|
, InnerAlloc1
|
||||||
> ScopedScoped1Inner;
|
> ScopedScoped1Inner;
|
||||||
typedef scoped_allocator_adaptor
|
|
||||||
< scoped_allocator_adaptor
|
|
||||||
<Outer10IdAlloc, Inner11IdAlloc1, Inner12IdAlloc2>
|
|
||||||
, InnerAlloc1, InnerAlloc2
|
|
||||||
> ScopedScoped2Inner;
|
|
||||||
typedef scoped_allocator_adaptor< Rebound9OuterAlloc > Rebound9Scoped0Inner;
|
typedef scoped_allocator_adaptor< Rebound9OuterAlloc > Rebound9Scoped0Inner;
|
||||||
typedef scoped_allocator_adaptor< Rebound9OuterAlloc
|
typedef scoped_allocator_adaptor< Rebound9OuterAlloc
|
||||||
, InnerAlloc1 > Rebound9Scoped1Inner;
|
, InnerAlloc1 > Rebound9Scoped1Inner;
|
||||||
@@ -481,6 +487,64 @@ int main()
|
|||||||
Scoped1Inner s1i;
|
Scoped1Inner s1i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Copy constructor/assignment
|
||||||
|
{
|
||||||
|
Scoped0Inner s0i;
|
||||||
|
Scoped1Inner s1i;
|
||||||
|
Scoped2Inner s2i;
|
||||||
|
|
||||||
|
Scoped0Inner s0i_b(s0i);
|
||||||
|
Scoped1Inner s1i_b(s1i);
|
||||||
|
Scoped2Inner s2i_b(s2i);
|
||||||
|
|
||||||
|
if(!(s0i == s0i_b) ||
|
||||||
|
!(s1i == s1i_b) ||
|
||||||
|
!(s2i == s2i_b)
|
||||||
|
){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
s0i_b = s0i;
|
||||||
|
s1i_b = s1i;
|
||||||
|
s2i_b = s2i;
|
||||||
|
|
||||||
|
if(!(s0i == s0i_b) ||
|
||||||
|
!(s1i == s1i_b) ||
|
||||||
|
!(s2i == s2i_b)
|
||||||
|
){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Copy/move constructor/assignment
|
||||||
|
{
|
||||||
|
Scoped0Inner s0i;
|
||||||
|
Scoped1Inner s1i;
|
||||||
|
Scoped2Inner s2i;
|
||||||
|
|
||||||
|
Scoped0Inner s0i_b(::boost::move(s0i));
|
||||||
|
Scoped1Inner s1i_b(::boost::move(s1i));
|
||||||
|
Scoped2Inner s2i_b(::boost::move(s2i));
|
||||||
|
|
||||||
|
if(!(s0i_b.outer_allocator().m_move_contructed) ||
|
||||||
|
!(s1i_b.outer_allocator().m_move_contructed) ||
|
||||||
|
!(s2i_b.outer_allocator().m_move_contructed)
|
||||||
|
){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
s0i_b = ::boost::move(s0i);
|
||||||
|
s1i_b = ::boost::move(s1i);
|
||||||
|
s2i_b = ::boost::move(s2i);
|
||||||
|
|
||||||
|
if(!(s0i_b.outer_allocator().m_move_assigned) ||
|
||||||
|
!(s1i_b.outer_allocator().m_move_assigned) ||
|
||||||
|
!(s2i_b.outer_allocator().m_move_assigned)
|
||||||
|
){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//inner_allocator()
|
//inner_allocator()
|
||||||
{
|
{
|
||||||
Scoped0Inner s0i;
|
Scoped0Inner s0i;
|
||||||
@@ -880,7 +944,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
//Now test recursive OuterAllocator types (OuterAllocator is an scoped_allocator)
|
//Now test recursive OuterAllocator types (OuterAllocator is a scoped_allocator)
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -1102,17 +1166,8 @@ int main()
|
|||||||
using boost::container::container_detail::pair;
|
using boost::container::container_detail::pair;
|
||||||
typedef test_allocator< pair< tagged_integer<0>
|
typedef test_allocator< pair< tagged_integer<0>
|
||||||
, tagged_integer<0> >, 0> OuterPairAlloc;
|
, tagged_integer<0> >, 0> OuterPairAlloc;
|
||||||
typedef test_allocator< pair< tagged_integer<1>
|
|
||||||
, tagged_integer<1> >, 1> InnerPairAlloc1;
|
|
||||||
typedef test_allocator< pair< tagged_integer<2>
|
|
||||||
, tagged_integer<2> >, 2> InnerPairAlloc2;
|
|
||||||
//
|
//
|
||||||
typedef scoped_allocator_adaptor < OuterPairAlloc > ScopedPair0Inner;
|
typedef scoped_allocator_adaptor < OuterPairAlloc > ScopedPair0Inner;
|
||||||
typedef scoped_allocator_adaptor < OuterPairAlloc
|
|
||||||
, InnerPairAlloc1 > ScopedPair1Inner;
|
|
||||||
typedef scoped_allocator_adaptor < OuterPairAlloc
|
|
||||||
, InnerPairAlloc1
|
|
||||||
, InnerPairAlloc2 > ScopedPair2Inner;
|
|
||||||
|
|
||||||
ScopedPair0Inner s0i;
|
ScopedPair0Inner s0i;
|
||||||
//Check construction with 0 user arguments
|
//Check construction with 0 user arguments
|
||||||
|
Reference in New Issue
Block a user