$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r85167 - in trunk/boost/container: . detail
From: igaztanaga_at_[hidden]
Date: 2013-07-29 17:32:24
Author: igaztanaga
Date: 2013-07-29 17:32:23 EDT (Mon, 29 Jul 2013)
New Revision: 85167
URL: http://svn.boost.org/trac/boost/changeset/85167
Log:
Fixes #8892.
Text files modified: 
   trunk/boost/container/detail/flat_tree.hpp         |    15 +++++++++---                            
   trunk/boost/container/detail/node_alloc_holder.hpp |    21 ++++++++++-------                       
   trunk/boost/container/detail/tree.hpp              |    47 ++++++++++++++++++++++----------------- 
   trunk/boost/container/flat_map.hpp                 |    20 +++++++++++++++-                        
   trunk/boost/container/flat_set.hpp                 |    21 +++++++++++++++++                       
   trunk/boost/container/map.hpp                      |    24 ++++++++++++++++++-                     
   trunk/boost/container/set.hpp                      |    14 +++++++++++                             
   7 files changed, 124 insertions(+), 38 deletions(-)
Modified: trunk/boost/container/detail/flat_tree.hpp
==============================================================================
--- trunk/boost/container/detail/flat_tree.hpp	Mon Jul 29 05:20:23 2013	(r85166)
+++ trunk/boost/container/detail/flat_tree.hpp	2013-07-29 17:32:23 EDT (Mon, 29 Jul 2013)	(r85167)
@@ -115,7 +115,7 @@
          : value_compare(), m_vect()
       {}
 
-      Data(const Data &d)
+      explicit Data(const Data &d)
          : value_compare(static_cast<const value_compare&>(d)), m_vect(d.m_vect)
       {}
 
@@ -131,15 +131,18 @@
          : value_compare(boost::move(static_cast<value_compare&>(d))), m_vect(boost::move(d.m_vect), a)
       {}
 
-      Data(const Compare &comp)
+      explicit Data(const Compare &comp)
          : value_compare(comp), m_vect()
       {}
 
-      Data(const Compare &comp,
-           const allocator_t &alloc)
+      Data(const Compare &comp, const allocator_t &alloc)
          : value_compare(comp), m_vect(alloc)
       {}
 
+      explicit Data(const allocator_t &alloc)
+         : value_compare(), m_vect(alloc)
+      {}
+
       Data& operator=(BOOST_COPY_ASSIGN_REF(Data) d)
       {
          this->value_compare::operator=(d);
@@ -203,6 +206,10 @@
       : m_data(comp, a)
    { }
 
+   explicit flat_tree(const allocator_type& a)
+      : m_data(a)
+   { }
+
    flat_tree(const flat_tree& x)
       :  m_data(x.m_data)
    { }
Modified: trunk/boost/container/detail/node_alloc_holder.hpp
==============================================================================
--- trunk/boost/container/detail/node_alloc_holder.hpp	Mon Jul 29 05:20:23 2013	(r85166)
+++ trunk/boost/container/detail/node_alloc_holder.hpp	2013-07-29 17:32:23 EDT (Mon, 29 Jul 2013)	(r85167)
@@ -53,10 +53,14 @@
    typedef typename ValueCompare::value_type   value_type;
    typedef typename ValueCompare::key_of_value key_of_value;
 
-   node_compare(const ValueCompare &pred)
+   explicit node_compare(const ValueCompare &pred)
       :  ValueCompare(pred)
    {}
 
+   node_compare()
+      :  ValueCompare()
+   {}
+
    ValueCompare &value_comp()
    {  return static_cast<ValueCompare &>(*this);  }
 
@@ -67,11 +71,10 @@
    {  return ValueCompare::operator()(a.get_data(), b.get_data());  }
 };
 
-template<class A, class ICont, class Pred = container_detail::nat>
+template<class A, class ICont, class ValPred = container_detail::nat>
 struct node_alloc_holder
 {
    typedef allocator_traits<A>                                    allocator_traits_type;
-   typedef node_alloc_holder<A, ICont>                            self_t;
    typedef typename allocator_traits_type::value_type             value_type;
    typedef typename ICont::value_type                             Node;
    typedef typename allocator_traits_type::template
@@ -116,20 +119,20 @@
    {  this->icont().swap(x.icont());  }
 
    //Constructors for associative containers
-   explicit node_alloc_holder(const ValAlloc &a, const Pred &c)
+   explicit node_alloc_holder(const ValAlloc &a, const ValPred &c)
       : members_(a, c)
    {}
 
-   explicit node_alloc_holder(const node_alloc_holder &x, const Pred &c)
+   explicit node_alloc_holder(const node_alloc_holder &x, const ValPred &c)
       : members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()), c)
    {}
 
-   explicit node_alloc_holder(const Pred &c)
+   explicit node_alloc_holder(const ValPred &c)
       : members_(c)
    {}
 
    //helpers for move assignments
-   explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x, const Pred &c)
+   explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x, const ValPred &c)
       : members_(boost::move(x.node_alloc()), c)
    {  this->icont().swap(x.icont());  }
 
@@ -345,12 +348,12 @@
       {}
 
       template<class ConvertibleToAlloc>
-      members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc, const Pred &c)
+      members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc, const ValPred &c)
          :  NodeAlloc(boost::forward<ConvertibleToAlloc>(c2alloc))
          , m_icont(typename ICont::value_compare(c))
       {}
 
-      explicit members_holder(const Pred &c)
+      explicit members_holder(const ValPred &c)
          : NodeAlloc()
          , m_icont(typename ICont::value_compare(c))
       {}
Modified: trunk/boost/container/detail/tree.hpp
==============================================================================
--- trunk/boost/container/detail/tree.hpp	Mon Jul 29 05:20:23 2013	(r85166)
+++ trunk/boost/container/detail/tree.hpp	2013-07-29 17:32:23 EDT (Mon, 29 Jul 2013)	(r85167)
@@ -50,8 +50,12 @@
    typedef KeyOfValue   key_of_value;
    typedef Key          key_type;
 
-   tree_value_compare(const key_compare &kcomp)
-      :  key_compare(kcomp)
+   explicit tree_value_compare(const key_compare &kcomp)
+      :  KeyCompare(kcomp)
+   {}
+
+   tree_value_compare()
+      :  KeyCompare()
    {}
 
    const key_compare &key_comp() const
@@ -212,15 +216,15 @@
       , typename container_detail::intrusive_rbtree_type
          <A, tree_value_compare<Key, Value, KeyCompare, KeyOfValue> 
          >::type
-      , KeyCompare
+      , tree_value_compare<Key, Value, KeyCompare, KeyOfValue> 
       >
 {
+   typedef tree_value_compare
+            <Key, Value, KeyCompare, KeyOfValue>            ValComp;
    typedef typename container_detail::intrusive_rbtree_type
-         < A, tree_value_compare
-            <Key, Value, KeyCompare, KeyOfValue>
-         >::type                                            Icont;
+         < A, ValComp>::type                                Icont;
    typedef container_detail::node_alloc_holder 
-      <A, Icont, KeyCompare>                                AllocHolder;
+      <A, Icont, ValComp>                                   AllocHolder;
    typedef typename AllocHolder::NodePtr                    NodePtr;
    typedef rbtree < Key, Value, KeyOfValue
                   , KeyCompare, A>                          ThisType;
@@ -318,8 +322,7 @@
    typedef Value                                      value_type;
    typedef A                                          allocator_type;
    typedef KeyCompare                                 key_compare;
-   typedef tree_value_compare< Key, Value
-                        , KeyCompare, KeyOfValue>     value_compare;
+   typedef ValComp                                    value_compare;
    typedef typename boost::container::
       allocator_traits<A>::pointer                    pointer;
    typedef typename boost::container::
@@ -471,11 +474,15 @@
    typedef std::reverse_iterator<const_iterator>  const_reverse_iterator;
 
    rbtree()
-      : AllocHolder(key_compare())
+      : AllocHolder(ValComp(key_compare()))
+   {}
+
+   explicit rbtree(const key_compare& comp, const allocator_type& a = allocator_type())
+      : AllocHolder(a, ValComp(comp))
    {}
 
-   rbtree(const key_compare& comp, const allocator_type& a = allocator_type())
-      : AllocHolder(a, comp)
+   explicit rbtree(const allocator_type& a)
+      : AllocHolder(a)
    {}
 
    template <class InputIterator>
@@ -488,7 +495,7 @@
          >::type * = 0
       #endif
          )
-      : AllocHolder(a, comp)
+      : AllocHolder(a, value_compare(comp))
    {
       if(unique_insertion){
          this->insert_unique(first, last);
@@ -508,7 +515,7 @@
          >::type * = 0
       #endif
          )
-      : AllocHolder(a, comp)
+      : AllocHolder(a, value_compare(comp))
    {
       if(unique_insertion){
          this->insert_unique(first, last);
@@ -530,7 +537,7 @@
             >::type * = 0
          #endif
          )
-      : AllocHolder(a, comp)
+      : AllocHolder(a, value_compare(comp))
    {
       this->insert_equal(first, last);
    }
@@ -545,7 +552,7 @@
             >::type * = 0
          #endif
          )
-      : AllocHolder(a, comp)
+      : AllocHolder(a, value_compare(comp))
    {
       //Optimized allocation and construction
       this->allocate_many_and_construct
@@ -553,25 +560,25 @@
    }
 
    rbtree(const rbtree& x)
-      :  AllocHolder(x, x.key_comp())
+      :  AllocHolder(x, x.value_comp())
    {
       this->icont().clone_from
          (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
    }
 
    rbtree(BOOST_RV_REF(rbtree) x)
-      :  AllocHolder(::boost::move(static_cast<AllocHolder&>(x)), x.key_comp())
+      :  AllocHolder(::boost::move(static_cast<AllocHolder&>(x)), x.value_comp())
    {}
 
    rbtree(const rbtree& x, const allocator_type &a)
-      :  AllocHolder(a, x.key_comp())
+      :  AllocHolder(a, x.value_comp())
    {
       this->icont().clone_from
          (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
    }
 
    rbtree(BOOST_RV_REF(rbtree) x, const allocator_type &a)
-      :  AllocHolder(a, x.key_comp())
+      :  AllocHolder(a, x.value_comp())
    {
       if(this->node_alloc() == x.node_alloc()){
          this->icont().swap(x.icont());
Modified: trunk/boost/container/flat_map.hpp
==============================================================================
--- trunk/boost/container/flat_map.hpp	Mon Jul 29 05:20:23 2013	(r85166)
+++ trunk/boost/container/flat_map.hpp	2013-07-29 17:32:23 EDT (Mon, 29 Jul 2013)	(r85167)
@@ -173,7 +173,15 @@
    //!
    //! <b>Complexity</b>: Constant.
    explicit flat_map(const Compare& comp, const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a)) {}
+      : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
+   {}
+
+   //! <b>Effects</b>: Constructs an empty flat_map using the specified allocator.
+   //!
+   //! <b>Complexity</b>: Constant.
+   explicit flat_map(const allocator_type& a)
+      : m_flat_tree(container_detail::force<impl_allocator_type>(a))
+   {}
 
    //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
@@ -1024,7 +1032,15 @@
    //! <b>Complexity</b>: Constant.
    explicit flat_multimap(const Compare& comp,
                           const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a)) { }
+      : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
+   {}
+
+   //! <b>Effects</b>: Constructs an empty flat_multimap using the specified allocator.
+   //!
+   //! <b>Complexity</b>: Constant.
+   explicit flat_multimap(const allocator_type& a)
+      : m_flat_tree(container_detail::force<impl_allocator_type>(a))
+   {}
 
    //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
Modified: trunk/boost/container/flat_set.hpp
==============================================================================
--- trunk/boost/container/flat_set.hpp	Mon Jul 29 05:20:23 2013	(r85166)
+++ trunk/boost/container/flat_set.hpp	2013-07-29 17:32:23 EDT (Mon, 29 Jul 2013)	(r85167)
@@ -121,6 +121,13 @@
       : m_flat_tree(comp, a)
    {}
 
+   //! <b>Effects</b>: Constructs an empty flat_set using the specified allocator.
+   //!
+   //! <b>Complexity</b>: Constant.
+   explicit flat_set(const allocator_type& a)
+      : m_flat_tree(a)
+   {}
+
    //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
    //!
@@ -810,9 +817,21 @@
       : m_flat_tree()
    {}
 
+   //! <b>Effects</b>: Constructs an empty flat_multiset using the specified
+   //! comparison object and allocator.
+   //!
+   //! <b>Complexity</b>: Constant.
    explicit flat_multiset(const Compare& comp,
                           const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, a) {}
+      : m_flat_tree(comp, a)
+   {}
+
+   //! <b>Effects</b>: Constructs an empty flat_multiset using the specified allocator.
+   //!
+   //! <b>Complexity</b>: Constant.
+   explicit flat_multiset(const allocator_type& a)
+      : m_flat_tree(a)
+   {}
 
    template <class InputIterator>
    flat_multiset(InputIterator first, InputIterator last,
Modified: trunk/boost/container/map.hpp
==============================================================================
--- trunk/boost/container/map.hpp	Mon Jul 29 05:20:23 2013	(r85166)
+++ trunk/boost/container/map.hpp	2013-07-29 17:32:23 EDT (Mon, 29 Jul 2013)	(r85167)
@@ -138,6 +138,16 @@
       BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
    }
 
+   //! <b>Effects</b>: Constructs an empty map using the specified allocator.
+   //!
+   //! <b>Complexity</b>: Constant.
+   explicit map(const allocator_type& a)
+      : m_tree(a)
+   {
+      //Allocator type must be std::pair<CONST Key, T>
+      BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
+   }
+
    //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
    //!
@@ -918,8 +928,7 @@
       BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
    }
 
-   //! <b>Effects</b>: Constructs an empty multimap using the specified comparison
-   //!   object and allocator.
+   //! <b>Effects</b>: Constructs an empty multimap using the specified allocator.
    //!
    //! <b>Complexity</b>: Constant.
    explicit multimap(const Compare& comp, const allocator_type& a = allocator_type())
@@ -929,6 +938,17 @@
       BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
    }
 
+   //! <b>Effects</b>: Constructs an empty multimap using the specified comparison
+   //!   object and allocator.
+   //!
+   //! <b>Complexity</b>: Constant.
+   explicit multimap(const allocator_type& a)
+      : m_tree(a)
+   {
+      //Allocator type must be std::pair<CONST Key, T>
+      BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
+   }
+
    //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
    //!
Modified: trunk/boost/container/set.hpp
==============================================================================
--- trunk/boost/container/set.hpp	Mon Jul 29 05:20:23 2013	(r85166)
+++ trunk/boost/container/set.hpp	2013-07-29 17:32:23 EDT (Mon, 29 Jul 2013)	(r85167)
@@ -113,6 +113,13 @@
       : m_tree(comp, a)
    {}
 
+   //! <b>Effects</b>: Constructs an empty set using the specified allocator object.
+   //!
+   //! <b>Complexity</b>: Constant.
+   explicit set(const allocator_type& a)
+      : m_tree(a)
+   {}
+
    //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
    //!
@@ -737,6 +744,13 @@
       : m_tree(comp, a)
    {}
 
+   //! <b>Effects</b>: Constructs an empty multiset using the specified allocator.
+   //!
+   //! <b>Complexity</b>: Constant.
+   explicit multiset(const allocator_type& a)
+      : m_tree(a)
+   {}
+
    //! <b>Effects</b>: Constructs an empty multiset using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
    //!