Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81652 - in trunk/boost/variant: . detail
From: antoshkka_at_[hidden]
Date: 2012-12-01 10:32:08


Author: apolukhin
Date: 2012-12-01 10:32:07 EST (Sat, 01 Dec 2012)
New Revision: 81652
URL: http://svn.boost.org/trac/boost/changeset/81652

Log:
Refs #7718 :
Workaroung GCC-4.7.2 internal compiler error
More functions marked with BOOST_NOEXCEPT
Added move constructors and move assignment operators to recursive_wrapper
Text files modified:
   trunk/boost/variant/detail/backup_holder.hpp | 7 ++++---
   trunk/boost/variant/recursive_wrapper.hpp | 39 +++++++++++++++++++++++++++++++++++++--
   trunk/boost/variant/variant.hpp | 2 +-
   3 files changed, 42 insertions(+), 6 deletions(-)

Modified: trunk/boost/variant/detail/backup_holder.hpp
==============================================================================
--- trunk/boost/variant/detail/backup_holder.hpp (original)
+++ trunk/boost/variant/detail/backup_holder.hpp 2012-12-01 10:32:07 EST (Sat, 01 Dec 2012)
@@ -13,6 +13,7 @@
 #ifndef BOOST_VARIANT_DETAIL_BACKUP_HOLDER_HPP
 #define BOOST_VARIANT_DETAIL_BACKUP_HOLDER_HPP
 
+#include "boost/config.hpp"
 #include "boost/assert.hpp"
 
 namespace boost {
@@ -32,7 +33,7 @@
         delete backup_;
     }
 
- explicit backup_holder(T* backup)
+ explicit backup_holder(T* backup) BOOST_NOEXCEPT
         : backup_(backup)
     {
     }
@@ -53,7 +54,7 @@
         return *this;
     }
 
- void swap(backup_holder& rhs)
+ void swap(backup_holder& rhs) BOOST_NOEXCEPT
     {
         T* tmp = rhs.backup_;
         rhs.backup_ = this->backup_;
@@ -83,7 +84,7 @@
 }
 
 template <typename T>
-void swap(backup_holder<T>& lhs, backup_holder<T>& rhs)
+void swap(backup_holder<T>& lhs, backup_holder<T>& rhs) BOOST_NOEXCEPT
 {
     lhs.swap(rhs);
 }

Modified: trunk/boost/variant/recursive_wrapper.hpp
==============================================================================
--- trunk/boost/variant/recursive_wrapper.hpp (original)
+++ trunk/boost/variant/recursive_wrapper.hpp 2012-12-01 10:32:07 EST (Sat, 01 Dec 2012)
@@ -14,6 +14,7 @@
 #define BOOST_VARIANT_RECURSIVE_WRAPPER_HPP
 
 #include "boost/variant/recursive_wrapper_fwd.hpp"
+#include "boost/variant/detail/move.hpp"
 #include "boost/checked_delete.hpp"
 
 namespace boost {
@@ -43,6 +44,11 @@
     recursive_wrapper(const recursive_wrapper& operand);
     recursive_wrapper(const T& operand);
 
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ recursive_wrapper(recursive_wrapper&& operand);
+ recursive_wrapper(T&& operand);
+#endif
+
 private: // helpers, for modifiers (below)
 
     void assign(const T& rhs);
@@ -61,13 +67,28 @@
         return *this;
     }
 
- void swap(recursive_wrapper& operand)
+ void swap(recursive_wrapper& operand) BOOST_NOEXCEPT
     {
         T* temp = operand.p_;
         operand.p_ = p_;
         p_ = temp;
     }
 
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ recursive_wrapper& operator=(recursive_wrapper&& rhs) BOOST_NOEXCEPT
+ {
+ swap(rhs);
+ return *this;
+ }
+
+ recursive_wrapper& operator=(T&& rhs)
+ {
+ get() = detail::variant::move(rhs);
+ return *this;
+ }
+#endif
+
 public: // queries
 
     T& get() { return *get_pointer(); }
@@ -102,6 +123,20 @@
 {
 }
 
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+template <typename T>
+recursive_wrapper<T>::recursive_wrapper(recursive_wrapper&& operand)
+ : p_(new T( detail::variant::move(operand.get()) ))
+{
+}
+
+template <typename T>
+recursive_wrapper<T>::recursive_wrapper(T&& operand)
+ : p_(new T( detail::variant::move(operand) ))
+{
+}
+#endif
+
 template <typename T>
 void recursive_wrapper<T>::assign(const T& rhs)
 {
@@ -113,7 +148,7 @@
 // Swaps two recursive_wrapper<T> objects of the same type T.
 //
 template <typename T>
-inline void swap(recursive_wrapper<T>& lhs, recursive_wrapper<T>& rhs)
+inline void swap(recursive_wrapper<T>& lhs, recursive_wrapper<T>& rhs) BOOST_NOEXCEPT
 {
     lhs.swap(rhs);
 }

Modified: trunk/boost/variant/variant.hpp
==============================================================================
--- trunk/boost/variant/variant.hpp (original)
+++ trunk/boost/variant/variant.hpp 2012-12-01 10:32:07 EST (Sat, 01 Dec 2012)
@@ -1380,7 +1380,7 @@
         destroy_content();
     }
 
- variant() BOOST_NOEXCEPT_IF(boost::has_nothrow_constructor<internal_T0>::type::value)
+ variant()
     {
         // NOTE TO USER :
         // Compile error from here indicates that the first bound


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