|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85614 - in branches/release: boost/container boost/container/detail libs/container libs/container/doc libs/container/test
From: igaztanaga_at_[hidden]
Date: 2013-09-08 15:29:06
Author: igaztanaga
Date: 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013)
New Revision: 85614
URL: http://svn.boost.org/trac/boost/changeset/85614
Log:
Merged Container to the release branch
Replaced:
branches/release/boost/container/scoped_allocator_fwd.hpp
- copied unchanged from r85612, trunk/boost/container/scoped_allocator_fwd.hpp
Properties modified:
branches/release/boost/container/ (props changed)
branches/release/libs/container/ (props changed)
Text files modified:
branches/release/boost/container/deque.hpp | 1
branches/release/boost/container/detail/flat_tree.hpp | 146 ++++++++++++++-------------------------
branches/release/boost/container/scoped_allocator.hpp | 105 ++++++++++++++++++----------
branches/release/boost/container/scoped_allocator_fwd.hpp | 83 ++++++++++++++++++++++
branches/release/libs/container/doc/container.qbk | 6 +
branches/release/libs/container/test/expand_bwd_test_template.hpp | 1
branches/release/libs/container/test/flat_tree_test.cpp | 73 --------------------
branches/release/libs/container/test/scoped_allocator_adaptor_test.cpp | 91 ++++++++++++++++++++----
8 files changed, 281 insertions(+), 225 deletions(-)
Modified: branches/release/boost/container/deque.hpp
==============================================================================
--- branches/release/boost/container/deque.hpp Sun Sep 8 15:28:44 2013 (r85613)
+++ branches/release/boost/container/deque.hpp 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013) (r85614)
@@ -736,7 +736,6 @@
}
//If unequal allocators, then do a one by one move
else{
- typedef typename std::iterator_traits<iterator>::iterator_category ItCat;
this->assign( boost::make_move_iterator(x.begin())
, boost::make_move_iterator(x.end()));
}
Modified: branches/release/boost/container/detail/flat_tree.hpp
==============================================================================
--- branches/release/boost/container/detail/flat_tree.hpp Sun Sep 8 15:28:44 2013 (r85613)
+++ branches/release/boost/container/detail/flat_tree.hpp 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013) (r85614)
@@ -323,21 +323,21 @@
// insert/erase
std::pair<iterator,bool> insert_unique(const value_type& val)
{
+ std::pair<iterator,bool> ret;
insert_commit_data data;
- std::pair<iterator,bool> ret = this->priv_insert_unique_prepare(val, data);
- if(ret.second){
- ret.first = this->priv_insert_commit(data, val);
- }
+ ret.second = this->priv_insert_unique_prepare(val, data);
+ ret.first = ret.second ? this->priv_insert_commit(data, val)
+ : iterator(vector_iterator_get_ptr(data.position));
return ret;
}
std::pair<iterator,bool> insert_unique(BOOST_RV_REF(value_type) val)
{
+ std::pair<iterator,bool> ret;
insert_commit_data data;
- std::pair<iterator,bool> ret = this->priv_insert_unique_prepare(val, data);
- if(ret.second){
- ret.first = this->priv_insert_commit(data, boost::move(val));
- }
+ ret.second = this->priv_insert_unique_prepare(val, data);
+ ret.first = ret.second ? this->priv_insert_commit(data, boost::move(val))
+ : iterator(vector_iterator_get_ptr(data.position));
return ret;
}
@@ -357,22 +357,20 @@
iterator insert_unique(const_iterator pos, const value_type& val)
{
+ std::pair<iterator,bool> ret;
insert_commit_data data;
- std::pair<iterator,bool> ret = this->priv_insert_unique_prepare(pos, val, data);
- if(ret.second){
- ret.first = this->priv_insert_commit(data, val);
- }
- return ret.first;
+ return this->priv_insert_unique_prepare(pos, val, data)
+ ? this->priv_insert_commit(data, val)
+ : iterator(vector_iterator_get_ptr(data.position));
}
- iterator insert_unique(const_iterator pos, BOOST_RV_REF(value_type) mval)
+ iterator insert_unique(const_iterator pos, BOOST_RV_REF(value_type) val)
{
+ std::pair<iterator,bool> ret;
insert_commit_data data;
- std::pair<iterator,bool> ret = this->priv_insert_unique_prepare(pos, mval, data);
- if(ret.second){
- ret.first = this->priv_insert_commit(data, boost::move(mval));
- }
- return ret.first;
+ return this->priv_insert_unique_prepare(pos, val, data)
+ ? this->priv_insert_commit(data, boost::move(val))
+ : iterator(vector_iterator_get_ptr(data.position));
}
iterator insert_equal(const_iterator pos, const value_type& val)
@@ -553,13 +551,7 @@
stored_allocator_type &a = this->get_stored_allocator();
stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... );
value_destructor<stored_allocator_type> d(a, val);
- insert_commit_data data;
- std::pair<iterator,bool> ret =
- this->priv_insert_unique_prepare(val, data);
- if(ret.second){
- ret.first = this->priv_insert_commit(data, boost::move(val));
- }
- return ret;
+ return this->insert_unique(::boost::move(val));
}
template <class... Args>
@@ -570,12 +562,7 @@
stored_allocator_type &a = this->get_stored_allocator();
stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... );
value_destructor<stored_allocator_type> d(a, val);
- insert_commit_data data;
- std::pair<iterator,bool> ret = this->priv_insert_unique_prepare(hint, val, data);
- if(ret.second){
- ret.first = this->priv_insert_commit(data, boost::move(val));
- }
- return ret.first;
+ return this->insert_unique(hint, ::boost::move(val));
}
template <class... Args>
@@ -586,9 +573,7 @@
stored_allocator_type &a = this->get_stored_allocator();
stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... );
value_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));
- return i;
+ return this->insert_equal(::boost::move(val));
}
template <class... Args>
@@ -599,10 +584,7 @@
stored_allocator_type &a = this->get_stored_allocator();
stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... );
value_destructor<stored_allocator_type> d(a, val);
- insert_commit_data data;
- this->priv_insert_equal_prepare(hint, val, data);
- iterator i = this->priv_insert_commit(data, boost::move(val));
- return i;
+ return this->insert_equal(hint, ::boost::move(val));
}
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -618,12 +600,7 @@
stored_allocator_traits::construct(a, &val \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
value_destructor<stored_allocator_type> d(a, val); \
- insert_commit_data data; \
- std::pair<iterator,bool> ret = this->priv_insert_unique_prepare(val, data); \
- if(ret.second){ \
- ret.first = this->priv_insert_commit(data, boost::move(val)); \
- } \
- return ret; \
+ return this->insert_unique(::boost::move(val)); \
} \
\
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
@@ -635,13 +612,8 @@
stored_allocator_type &a = this->get_stored_allocator(); \
stored_allocator_traits::construct(a, &val \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
- value_destructor<stored_allocator_type> d(a, val); \
- insert_commit_data data; \
- std::pair<iterator,bool> ret = this->priv_insert_unique_prepare(hint, val, data); \
- if(ret.second){ \
- ret.first = this->priv_insert_commit(data, boost::move(val)); \
- } \
- return ret.first; \
+ value_destructor<stored_allocator_type> d(a, val); \
+ return this->insert_unique(hint, ::boost::move(val)); \
} \
\
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
@@ -653,9 +625,7 @@
stored_allocator_traits::construct(a, &val \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
value_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)); \
- return i; \
+ return this->insert_equal(::boost::move(val)); \
} \
\
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
@@ -668,12 +638,8 @@
stored_allocator_traits::construct(a, &val \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
value_destructor<stored_allocator_type> d(a, val); \
- insert_commit_data data; \
- this->priv_insert_equal_prepare(hint, val, data); \
- iterator i = this->priv_insert_commit(data, boost::move(val)); \
- return i; \
+ return this->insert_equal(hint, ::boost::move(val)); \
} \
-
//!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
@@ -798,21 +764,19 @@
}
}
- std::pair<iterator,bool> priv_insert_unique_prepare
+ bool priv_insert_unique_prepare
(const_iterator b, const_iterator e, const value_type& val, insert_commit_data &commit_data)
{
const value_compare &value_comp = this->m_data;
commit_data.position = this->priv_lower_bound(b, e, KeyOfValue()(val));
- return std::pair<iterator,bool>
- ( iterator(vector_iterator_get_ptr(commit_data.position))
- , commit_data.position == e || value_comp(val, *commit_data.position));
+ return commit_data.position == e || value_comp(val, *commit_data.position);
}
- std::pair<iterator,bool> priv_insert_unique_prepare
+ bool priv_insert_unique_prepare
(const value_type& val, insert_commit_data &commit_data)
- { return this->priv_insert_unique_prepare(this->begin(), this->end(), val, commit_data); }
+ { return this->priv_insert_unique_prepare(this->cbegin(), this->cend(), val, commit_data); }
- std::pair<iterator,bool> priv_insert_unique_prepare
+ bool priv_insert_unique_prepare
(const_iterator pos, const value_type& val, insert_commit_data &commit_data)
{
//N1780. Props to Howard Hinnant!
@@ -827,37 +791,33 @@
//else
// insert val before lower_bound(val)
const value_compare &value_comp = this->m_data;
-
- if(pos == this->cend() || value_comp(val, *pos)){
- if(pos != this->cbegin() && !value_comp(val, pos[-1])){
- if(value_comp(pos[-1], val)){
- commit_data.position = pos;
- return std::pair<iterator,bool>(iterator(vector_iterator_get_ptr(pos)), true);
- }
- else{
- return std::pair<iterator,bool>(iterator(vector_iterator_get_ptr(pos)), false);
- }
+ const const_iterator cend_it = this->cend();
+ if(pos == cend_it || value_comp(val, *pos)){ //Check if val should go before end
+ const const_iterator cbeg = this->cbegin();
+ commit_data.position = pos;
+ if(pos == cbeg){ //If container is empty then insert it in the beginning
+ return true;
+ }
+ const_iterator prev(pos);
+ --prev;
+ if(value_comp(*prev, val)){ //If previous element was less, then it should go between prev and pos
+ return true;
+ }
+ else if(!value_comp(val, *prev)){ //If previous was equal then insertion should fail
+ commit_data.position = prev;
+ return false;
+ }
+ else{ //Previous was bigger so insertion hint was pointless, dispatch to hintless insertion
+ //but reduce the search between beg and prev as prev is bigger than val
+ return this->priv_insert_unique_prepare(cbeg, prev, val, commit_data);
}
- return this->priv_insert_unique_prepare(this->cbegin(), pos, val, commit_data);
}
-
- // Works, but increases code complexity
- //Next check
- //else if (value_comp(*pos, val) && !value_comp(pos[1], val)){
- // if(value_comp(val, pos[1])){
- // commit_data.position = pos+1;
- // return std::pair<iterator,bool>(pos+1, true);
- // }
- // else{
- // return std::pair<iterator,bool>(pos+1, false);
- // }
- //}
else{
- //[... pos ... val ... ]
//The hint is before the insertion position, so insert it
- //in the remaining range
- return this->priv_insert_unique_prepare(pos, this->end(), val, commit_data);
+ //in the remaining range [pos, end)
+ return this->priv_insert_unique_prepare(pos, cend_it, val, commit_data);
}
+ //return priv_insert_unique_prepare(val, commit_data);
}
template<class Convertible>
Modified: branches/release/boost/container/scoped_allocator.hpp
==============================================================================
--- branches/release/boost/container/scoped_allocator.hpp Sun Sep 8 15:28:44 2013 (r85613)
+++ branches/release/boost/container/scoped_allocator.hpp 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013) (r85614)
@@ -583,8 +583,10 @@
};
typedef OuterAlloc outer_allocator_type;
- typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type;
- typedef allocator_traits<inner_allocator_type> inner_traits_type;
+ typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type;
+ typedef allocator_traits<inner_allocator_type> inner_traits_type;
+ typedef scoped_allocator_adaptor
+ <OuterAlloc, InnerAllocs...> scoped_allocator_type;
typedef boost::integral_constant<
bool,
outer_traits_type::propagate_on_container_copy_assignment::value ||
@@ -635,7 +637,7 @@
, m_inner(other.inner_allocator())
{}
- protected:
+ public:
struct internal_type_t{};
template <class OuterA2>
@@ -670,6 +672,9 @@
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()
{ return m_inner; }
@@ -682,6 +687,15 @@
const outer_allocator_type &outer_allocator() const
{ 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:
inner_allocator_type m_inner;
};
@@ -730,6 +744,11 @@
( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \
, BOOST_CONTAINER_PP_IDENTITY, nat) \
> 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 boost::integral_constant< \
bool, \
@@ -790,7 +809,7 @@
, m_inner(other.inner_allocator()) \
{} \
\
- protected: \
+ public: \
struct internal_type_t{}; \
\
template <class OuterA2> \
@@ -824,6 +843,9 @@
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() \
{ return m_inner; } \
\
@@ -836,6 +858,14 @@
const outer_allocator_type &outer_allocator() const \
{ 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: \
inner_allocator_type m_inner; \
}; \
@@ -874,6 +904,7 @@
typedef OuterAlloc outer_allocator_type;
typedef allocator_traits<OuterAlloc> outer_traits_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 typename outer_traits_type::
propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
@@ -922,7 +953,7 @@
: outer_allocator_type(other.outer_allocator())
{}
- protected:
+ public:
struct internal_type_t{};
template <class OuterA2>
@@ -948,6 +979,9 @@
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()
{ return static_cast<inner_allocator_type&>(*this); }
@@ -959,6 +993,17 @@
const outer_allocator_type &outer_allocator() const
{ 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 {
@@ -1040,7 +1085,7 @@
, true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
#endif
> base_type;
- typedef typename base_type::internal_type_t internal_type_t;
+ typedef typename base_type::internal_type_t internal_type_t;
/// @endcond
typedef OuterAlloc outer_allocator_type;
//! Type: For exposition only
@@ -1164,48 +1209,37 @@
{}
scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other)
- {
- base_type::operator=(static_cast<const base_type &>(other));
- return *this;
- }
+ { return static_cast<scoped_allocator_adaptor&>(base_type::operator=(static_cast<const base_type &>(other))); }
scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other)
- {
- base_type::operator=(boost::move(static_cast<scoped_allocator_adaptor&>(other)));
- return *this;
- }
+ { return static_cast<scoped_allocator_adaptor&>(base_type::operator=(boost::move(static_cast<base_type&>(other)))); }
+ #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Effects</b>: swaps *this with r.
//!
- void swap(scoped_allocator_adaptor &r)
- {
- base_type::swap(r);
- }
+ void swap(scoped_allocator_adaptor &r);
//! <b>Effects</b>: swaps *this with r.
//!
- friend void swap(scoped_allocator_adaptor &l, scoped_allocator_adaptor &r)
- { l.swap(r); }
+ friend void swap(scoped_allocator_adaptor &l, scoped_allocator_adaptor &r);
//! <b>Returns</b>:
//! `static_cast<OuterAlloc&>(*this)`.
- outer_allocator_type & outer_allocator()
- { return *this; }
+ outer_allocator_type & outer_allocator();
//! <b>Returns</b>:
//! `static_cast<const OuterAlloc&>(*this)`.
- const outer_allocator_type &outer_allocator() const
- { return *this; }
+ const outer_allocator_type &outer_allocator() const;
//! <b>Returns</b>:
//! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
- inner_allocator_type& inner_allocator()
- { return base_type::inner_allocator(); }
+ inner_allocator_type& inner_allocator();
//! <b>Returns</b>:
//! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
- inner_allocator_type const& inner_allocator() const
- { return base_type::inner_allocator(); }
+ inner_allocator_type const& inner_allocator() const;
+
+ #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Returns</b>:
//! `allocator_traits<OuterAlloc>::max_size(outer_allocator())`.
@@ -1244,18 +1278,14 @@
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
//! A in the adaptor is initialized from the result of calling
//! `allocator_traits<Allocator>::select_on_container_copy_construction()` on
//! the corresponding allocator in *this.
- scoped_allocator_adaptor select_on_container_copy_construction() const
- {
- 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())
- );
- }
+ scoped_allocator_adaptor select_on_container_copy_construction() const;
+ #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
+
/// @cond
base_type &base() { return *this; }
@@ -1426,7 +1456,8 @@
//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:
+ public:
+ //Internal function
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)
Copied: branches/release/boost/container/scoped_allocator_fwd.hpp (from r85612, trunk/boost/container/scoped_allocator_fwd.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/container/scoped_allocator_fwd.hpp 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013) (r85614, copy of r85612, trunk/boost/container/scoped_allocator_fwd.hpp)
@@ -0,0 +1,83 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
+#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
+
+#if (defined MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+#include <boost/container/detail/preprocessor.hpp>
+#include <boost/container/detail/type_traits.hpp>
+#endif
+
+namespace boost { namespace container {
+
+///@cond
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+ #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+ template <typename OuterAlloc, typename ...InnerAllocs>
+ class scoped_allocator_adaptor;
+
+ #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+ template <typename ...InnerAllocs>
+ class scoped_allocator_adaptor;
+
+ template <typename OuterAlloc, typename ...InnerAllocs>
+ class scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>;
+
+ #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+
+#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+template <typename OuterAlloc
+BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT, container_detail::nat)
+>
+class scoped_allocator_adaptor;
+
+#endif
+
+///@endcond
+
+//! The allocator_arg_t struct is an empty structure type used as a unique type to
+//! disambiguate constructor and function overloading. Specifically, several types
+//! have constructors with allocator_arg_t as the first argument, immediately followed
+//! by an argument of a type that satisfies the Allocator requirements
+struct allocator_arg_t{};
+
+//! A instance of type allocator_arg_t
+//!
+static const allocator_arg_t allocator_arg = allocator_arg_t();
+
+template <class T>
+struct constructible_with_allocator_suffix;
+
+template <class T>
+struct constructible_with_allocator_prefix;
+
+template <typename T, typename Alloc>
+struct uses_allocator;
+
+}} // namespace boost { namespace container {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
Modified: branches/release/libs/container/doc/container.qbk
==============================================================================
--- branches/release/libs/container/doc/container.qbk Sun Sep 8 15:28:44 2013 (r85613)
+++ branches/release/libs/container/doc/container.qbk 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013) (r85614)
@@ -718,9 +718,11 @@
* 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/8269 #8269].
+ [@https://svn.boost.org/trac/boost/ticket/8892 #8892],
+ [@https://svn.boost.org/trac/boost/ticket/9064 #9064].
+ [@https://svn.boost.org/trac/boost/ticket/9092 #9092].
[endsect]
Modified: branches/release/libs/container/test/expand_bwd_test_template.hpp
==============================================================================
--- branches/release/libs/container/test/expand_bwd_test_template.hpp Sun Sep 8 15:28:44 2013 (r85613)
+++ branches/release/libs/container/test/expand_bwd_test_template.hpp 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013) (r85614)
@@ -183,7 +183,6 @@
{
typedef typename VectorWithExpandBwdAllocator::value_type value_type;
typedef typename boost::remove_volatile<value_type>::type non_volatile_value_type;
- typedef std::vector<non_volatile_value_type> Vect;
const int MemorySize = 200;
const int Offset[] = { 50, 50, 50};
Modified: branches/release/libs/container/test/flat_tree_test.cpp
==============================================================================
--- branches/release/libs/container/test/flat_tree_test.cpp Sun Sep 8 15:28:44 2013 (r85613)
+++ branches/release/libs/container/test/flat_tree_test.cpp 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013) (r85614)
@@ -638,76 +638,3 @@
#include <boost/container/detail/config_end.hpp>
-/*
-#include <boost/container/map.hpp>
-#include <boost/container/flat_map.hpp>
-#include <boost/container/vector.hpp>
-#include <boost/move/utility.hpp>
-#include <iostream>
-
-struct Request
-{
- Request() {};
-
- //Move semantics...
- Request(BOOST_RV_REF(Request) r) : rvals() //Move constructor
- {
- rvals.swap(r.rvals);
- };
-
- Request& operator=(BOOST_RV_REF(Request) r) //Move assignment
- {
- if (this != &r){
- rvals.swap(r.rvals);
- }
- return *this;
- };
-
- // Values I want to be moved, not copied.
- boost::container::vector<int> rvals;
-
- private:
- // Mark this class movable but not copyable
- BOOST_MOVABLE_BUT_NOT_COPYABLE(Request)
-};
-
-typedef boost::container::flat_map<int, Request> Requests;
-//typedef boost::container::map<int, Request> Requests2;
-
-int
-main() {
- Requests req;
- std::pair<Requests::iterator, bool> ret = req.insert( Requests::value_type( 7, Request() ) );
- std::cout << "Insert success for req: " << ret.second << std::endl;
-
- //Requests2 req2;
- //std::pair<Requests::iterator, bool> ret2 = req2.insert( Requests2::value_type( 7, Request() ) );
- //std::cout << "Insert success for req2: " << ret2.second << std::endl;
-
- return 0;
-}
-*/
-/*
-#include <cstdlib>
-#include <iostream>
-#include <boost/container/flat_set.hpp>
-
-using namespace std;
-
-int main(int , char *[])
-{
- double d[] = {0, 0.2, 0.8, 1, 2, 3, 4};
- boost::container::flat_set<double> set;
-
- set.insert(0);
- set.insert(set.end(), 1);
- set.insert(set.end(), 3);
- set.insert(boost::container::ordered_unique_range_t(), d, d + sizeof(d)/sizeof(*d));
- boost::container::flat_set<double>::iterator it(set.begin());
- boost::container::flat_set<double>::iterator const itend(set.end());
- while(it != itend)
- cout << *it++ << endl;
-
- return 0;
-}
-*/
\ No newline at end of file
Modified: branches/release/libs/container/test/scoped_allocator_adaptor_test.cpp
==============================================================================
--- branches/release/libs/container/test/scoped_allocator_adaptor_test.cpp Sun Sep 8 15:28:44 2013 (r85613)
+++ branches/release/libs/container/test/scoped_allocator_adaptor_test.cpp 2013-09-08 15:29:06 EDT (Sun, 08 Sep 2013) (r85614)
@@ -36,16 +36,20 @@
typedef T value_type;
test_allocator()
+ : m_move_contructed(false), m_move_assigned(false)
{}
test_allocator(const test_allocator&)
+ : m_move_contructed(false), m_move_assigned(false)
{}
test_allocator(BOOST_RV_REF(test_allocator) )
+ : m_move_contructed(true), m_move_assigned(false)
{}
template<class U>
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>
@@ -53,10 +57,15 @@
{}
test_allocator & operator=(BOOST_COPY_ASSIGN_REF(test_allocator))
- { return *this; }
+ {
+ return *this;
+ }
test_allocator & operator=(BOOST_RV_REF(test_allocator))
- { return *this; }
+ {
+ m_move_assigned = true;
+ return *this;
+ }
std::size_t max_size() const
{ return std::size_t(Id); }
@@ -66,6 +75,9 @@
void deallocate(T*p, std::size_t)
{ 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>
@@ -252,7 +264,6 @@
typedef test_allocator<tagged_integer<1>, 1> InnerAlloc1;
typedef test_allocator<tagged_integer<2>, 2> InnerAlloc2;
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, true> OuterAllocTruePropagate;
@@ -277,11 +288,6 @@
<Outer10IdAlloc, Inner11IdAlloc1>
, InnerAlloc1
> 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
, InnerAlloc1 > Rebound9Scoped1Inner;
@@ -481,6 +487,64 @@
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()
{
Scoped0Inner s0i;
@@ -880,7 +944,7 @@
}
//////////////////////////////////////////////////////////////////////////////////
- //Now test recursive OuterAllocator types (OuterAllocator is an scoped_allocator)
+ //Now test recursive OuterAllocator types (OuterAllocator is a scoped_allocator)
//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
@@ -1102,17 +1166,8 @@
using boost::container::container_detail::pair;
typedef test_allocator< pair< tagged_integer<0>
, 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
- , InnerPairAlloc1 > ScopedPair1Inner;
- typedef scoped_allocator_adaptor < OuterPairAlloc
- , InnerPairAlloc1
- , InnerPairAlloc2 > ScopedPair2Inner;
ScopedPair0Inner s0i;
//Check construction with 0 user arguments
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk