Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79443 - in branches/maintenance/1_50_0/boost: . unordered unordered/detail
From: dnljms_at_[hidden]
Date: 2012-07-12 06:43:58


Author: danieljames
Date: 2012-07-12 06:43:57 EDT (Thu, 12 Jul 2012)
New Revision: 79443
URL: http://svn.boost.org/trac/boost/changeset/79443

Log:
Unordered: Fix using a C++03 allocator with C++11 compiler.

Because the nodes had an implicit constructor, the `has_construct` trait was
detecting that the nodes could be constructed by construction then copy, which
really wasn't wanted. Also add a check that nodes aren't been copy constructed
to make sure this doesn't happen again.

Properties modified:
   branches/maintenance/1_50_0/boost/ (props changed)
   branches/maintenance/1_50_0/boost/unordered/ (props changed)
Text files modified:
   branches/maintenance/1_50_0/boost/unordered/detail/equivalent.hpp | 18 ++++++++++++++++--
   branches/maintenance/1_50_0/boost/unordered/detail/unique.hpp | 18 ++++++++++++++++--
   2 files changed, 32 insertions(+), 4 deletions(-)

Modified: branches/maintenance/1_50_0/boost/unordered/detail/equivalent.hpp
==============================================================================
--- branches/maintenance/1_50_0/boost/unordered/detail/equivalent.hpp (original)
+++ branches/maintenance/1_50_0/boost/unordered/detail/equivalent.hpp 2012-07-12 06:43:57 EDT (Thu, 12 Jul 2012)
@@ -37,7 +37,7 @@
 
 #if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT
         template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
- grouped_node(BOOST_UNORDERED_EMPLACE_ARGS) :
+ explicit grouped_node(BOOST_UNORDERED_EMPLACE_ARGS) :
             node_base(),
             group_prev_(),
             hash_(0)
@@ -49,6 +49,10 @@
         ~grouped_node() {
             boost::unordered::detail::destroy(this->value_ptr());
         }
+
+ grouped_node(grouped_node const&) {
+ assert(false);
+ }
 #else
         grouped_node() :
             node_base(),
@@ -61,6 +65,9 @@
         {
             group_prev_ = self;
         }
+
+ private:
+ grouped_node& operator=(grouped_node const&);
     };
 
     template <typename T>
@@ -77,7 +84,7 @@
 
 #if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT
         template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
- grouped_ptr_node(BOOST_UNORDERED_EMPLACE_ARGS) :
+ explicit grouped_ptr_node(BOOST_UNORDERED_EMPLACE_ARGS) :
             bucket_base(),
             group_prev_(0),
             hash_(0)
@@ -89,6 +96,10 @@
         ~grouped_ptr_node() {
             boost::unordered::detail::destroy(this->value_ptr());
         }
+
+ grouped_ptr_node(grouped_ptr_node const&) {
+ assert(false);
+ }
 #else
         grouped_ptr_node() :
             bucket_base(),
@@ -101,6 +112,9 @@
         {
             group_prev_ = self;
         }
+
+ private:
+ grouped_ptr_node& operator=(grouped_ptr_node const&);
     };
 
     // If the allocator uses raw pointers use grouped_ptr_node

Modified: branches/maintenance/1_50_0/boost/unordered/detail/unique.hpp
==============================================================================
--- branches/maintenance/1_50_0/boost/unordered/detail/unique.hpp (original)
+++ branches/maintenance/1_50_0/boost/unordered/detail/unique.hpp 2012-07-12 06:43:57 EDT (Thu, 12 Jul 2012)
@@ -38,7 +38,7 @@
 
 #if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT
         template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
- unique_node(BOOST_UNORDERED_EMPLACE_ARGS) :
+ explicit unique_node(BOOST_UNORDERED_EMPLACE_ARGS) :
             node_base(),
             hash_(0)
         {
@@ -49,6 +49,10 @@
         ~unique_node() {
             boost::unordered::detail::destroy(this->value_ptr());
         }
+
+ unique_node(unique_node const&) {
+ BOOST_ASSERT(false);
+ }
 #else
         unique_node() :
             node_base(),
@@ -59,6 +63,9 @@
         void init(link_pointer)
         {
         }
+
+ private:
+ unique_node& operator=(unique_node const&);
     };
 
     template <typename T>
@@ -74,7 +81,7 @@
 
 #if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT
         template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
- ptr_node(BOOST_UNORDERED_EMPLACE_ARGS) :
+ explicit ptr_node(BOOST_UNORDERED_EMPLACE_ARGS) :
             bucket_base(),
             hash_(0)
         {
@@ -85,6 +92,10 @@
         ~ptr_node() {
             boost::unordered::detail::destroy(this->value_ptr());
         }
+
+ ptr_node(ptr_node const&) {
+ BOOST_ASSERT(false);
+ }
 #else
         ptr_node() :
             bucket_base(),
@@ -95,6 +106,9 @@
         void init(link_pointer)
         {
         }
+
+ private:
+ ptr_node& operator=(ptr_node const&);
     };
 
     // If the allocator uses raw pointers use ptr_node


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