Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86158 - in trunk/boost/variant: . detail
From: antoshkka_at_[hidden]
Date: 2013-10-04 02:49:00


Author: apolukhin
Date: 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013)
New Revision: 86158
URL: http://svn.boost.org/trac/boost/changeset/86158

Log:
More noexcept modifiers, especially for some of boost::get(T*) and assign/move_assign helpers (refs #7960)

Text files modified:
   trunk/boost/variant/bad_visit.hpp | 2 +-
   trunk/boost/variant/detail/apply_visitor_binary.hpp | 4 ++--
   trunk/boost/variant/detail/apply_visitor_delayed.hpp | 2 +-
   trunk/boost/variant/detail/backup_holder.hpp | 6 +++---
   trunk/boost/variant/get.hpp | 8 ++++----
   trunk/boost/variant/static_visitor.hpp | 11 +++++++----
   trunk/boost/variant/variant.hpp | 12 ++++++------
   trunk/boost/variant/visitor_ptr.hpp | 2 +-
   8 files changed, 25 insertions(+), 22 deletions(-)

Modified: trunk/boost/variant/bad_visit.hpp
==============================================================================
--- trunk/boost/variant/bad_visit.hpp Thu Oct 3 20:38:08 2013 (r86157)
+++ trunk/boost/variant/bad_visit.hpp 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013) (r86158)
@@ -28,7 +28,7 @@
 {
 public: // std::exception interface
 
- virtual const char * what() const throw()
+ virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
     {
         return "boost::bad_visit: "
                "failed visitation using boost::apply_visitor";

Modified: trunk/boost/variant/detail/apply_visitor_binary.hpp
==============================================================================
--- trunk/boost/variant/detail/apply_visitor_binary.hpp Thu Oct 3 20:38:08 2013 (r86157)
+++ trunk/boost/variant/detail/apply_visitor_binary.hpp 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013) (r86158)
@@ -52,7 +52,7 @@
 
 public: // structors
 
- apply_visitor_binary_invoke(Visitor& visitor, Value1& value1)
+ apply_visitor_binary_invoke(Visitor& visitor, Value1& value1) BOOST_NOEXCEPT
         : visitor_(visitor)
         , value1_(value1)
     {
@@ -87,7 +87,7 @@
 
 public: // structors
 
- apply_visitor_binary_unwrap(Visitor& visitor, Visitable2& visitable2)
+ apply_visitor_binary_unwrap(Visitor& visitor, Visitable2& visitable2) BOOST_NOEXCEPT
         : visitor_(visitor)
         , visitable2_(visitable2)
     {

Modified: trunk/boost/variant/detail/apply_visitor_delayed.hpp
==============================================================================
--- trunk/boost/variant/detail/apply_visitor_delayed.hpp Thu Oct 3 20:38:08 2013 (r86157)
+++ trunk/boost/variant/detail/apply_visitor_delayed.hpp 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013) (r86158)
@@ -49,7 +49,7 @@
 
 public: // structors
 
- explicit apply_visitor_delayed_t(Visitor& visitor)
+ explicit apply_visitor_delayed_t(Visitor& visitor) BOOST_NOEXCEPT
       : visitor_(visitor)
     {
     }

Modified: trunk/boost/variant/detail/backup_holder.hpp
==============================================================================
--- trunk/boost/variant/detail/backup_holder.hpp Thu Oct 3 20:38:08 2013 (r86157)
+++ trunk/boost/variant/detail/backup_holder.hpp 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013) (r86158)
@@ -28,7 +28,7 @@
 
 public: // structors
 
- ~backup_holder()
+ ~backup_holder() BOOST_NOEXCEPT
     {
         delete backup_;
     }
@@ -63,12 +63,12 @@
 
 public: // queries
 
- T& get()
+ T& get() BOOST_NOEXCEPT
     {
         return *backup_;
     }
 
- const T& get() const
+ const T& get() const BOOST_NOEXCEPT
     {
         return *backup_;
     }

Modified: trunk/boost/variant/get.hpp
==============================================================================
--- trunk/boost/variant/get.hpp Thu Oct 3 20:38:08 2013 (r86157)
+++ trunk/boost/variant/get.hpp 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013) (r86158)
@@ -72,13 +72,13 @@
 
 public: // visitor interfaces
 
- pointer operator()(reference operand) const
+ pointer operator()(reference operand) const BOOST_NOEXCEPT
     {
         return boost::addressof(operand);
     }
 
     template <typename U>
- pointer operator()(const U&) const
+ pointer operator()(const U&) const BOOST_NOEXCEPT
     {
         return static_cast<pointer>(0);
     }
@@ -99,7 +99,7 @@
 get(
       boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
       BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
- )
+ ) BOOST_NOEXCEPT
 {
     typedef typename add_pointer<U>::type U_ptr;
     if (!operand) return static_cast<U_ptr>(0);
@@ -114,7 +114,7 @@
 get(
       const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >* operand
       BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(U)
- )
+ ) BOOST_NOEXCEPT
 {
     typedef typename add_pointer<const U>::type U_ptr;
     if (!operand) return static_cast<U_ptr>(0);

Modified: trunk/boost/variant/static_visitor.hpp
==============================================================================
--- trunk/boost/variant/static_visitor.hpp Thu Oct 3 20:38:08 2013 (r86157)
+++ trunk/boost/variant/static_visitor.hpp 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013) (r86158)
@@ -48,10 +48,13 @@
     typedef R result_type;
 
 protected: // for use as base class only
-
- static_visitor() { }
- ~static_visitor() { }
-
+#ifndef BOOST_NO_DEFAULTED_FUNCTIONS
+ static_visitor() = default;
+ ~static_visitor() = default;
+#else
+ static_visitor() BOOST_NOEXCEPT { }
+ ~static_visitor() BOOST_NOEXCEPT { }
+#endif
 };
 
 //////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/variant/variant.hpp
==============================================================================
--- trunk/boost/variant/variant.hpp Thu Oct 3 20:38:08 2013 (r86157)
+++ trunk/boost/variant/variant.hpp 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013) (r86158)
@@ -313,9 +313,9 @@
 
     template <typename T>
         BOOST_VARIANT_AUX_RETURN_VOID_TYPE
- internal_visit(T& operand, int) const
+ internal_visit(T& operand, int) const BOOST_NOEXCEPT
     {
- operand.~T();
+ operand.~T(); // must be noexcept
 
 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551)) || \
     BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
@@ -1313,7 +1313,7 @@
     {
     };
 
- void destroy_content()
+ void destroy_content() BOOST_NOEXCEPT
     {
         detail::variant::destroyer visitor;
         this->internal_apply_visitor(visitor);
@@ -1769,7 +1769,7 @@
             , mpl::true_ // has_nothrow_copy
             , B1 // is_nothrow_move_constructible
             , B2 // has_fallback_type
- ) const
+ ) const BOOST_NOEXCEPT
         {
             // Destroy lhs's content...
             lhs_.destroy_content(); // nothrow
@@ -1915,7 +1915,7 @@
             , mpl::true_ // has_nothrow_copy
             , mpl::false_ // is_nothrow_move_constructible
             , B2 // has_fallback_type
- ) const
+ ) const BOOST_NOEXCEPT
         {
             assigner::assign_impl(rhs_content, mpl::true_(), mpl::false_(), B2());
         }
@@ -1926,7 +1926,7 @@
             , B // has_nothrow_copy
             , mpl::true_ // is_nothrow_move_constructible
             , B2 // has_fallback_type
- ) const
+ ) const BOOST_NOEXCEPT
         {
             // ...destroy lhs's content...
             assigner::lhs_.destroy_content(); // nothrow

Modified: trunk/boost/variant/visitor_ptr.hpp
==============================================================================
--- trunk/boost/variant/visitor_ptr.hpp Thu Oct 3 20:38:08 2013 (r86157)
+++ trunk/boost/variant/visitor_ptr.hpp 2013-10-04 02:48:59 EDT (Fri, 04 Oct 2013) (r86158)
@@ -55,7 +55,7 @@
 
 public: // structors
 
- explicit visitor_ptr_t(visitor_t visitor)
+ explicit visitor_ptr_t(visitor_t visitor) BOOST_NOEXCEPT
       : visitor_(visitor)
     {
     }


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