diff options
Diffstat (limited to 'boost/exception/detail/error_info_impl.hpp')
-rw-r--r-- | boost/exception/detail/error_info_impl.hpp | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/boost/exception/detail/error_info_impl.hpp b/boost/exception/detail/error_info_impl.hpp index ecd086dd87..6c48d61ab3 100644 --- a/boost/exception/detail/error_info_impl.hpp +++ b/boost/exception/detail/error_info_impl.hpp @@ -5,6 +5,14 @@ #ifndef UUID_CE6983AC753411DDA764247956D89593 #define UUID_CE6983AC753411DDA764247956D89593 + +#include <boost/config.hpp> +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +#include <boost/type_traits/is_nothrow_move_constructible.hpp> +#endif +#include <utility> +#include <string> + #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) #pragma GCC system_header #endif @@ -12,10 +20,6 @@ #pragma warning(push,1) #endif -#include <boost/config.hpp> -#include <utility> -#include <string> - namespace boost { @@ -28,8 +32,7 @@ boost public: virtual std::string name_value_string() const = 0; - - protected: + virtual error_info_base * clone() const = 0; virtual ~error_info_base() throw() @@ -43,39 +46,53 @@ boost error_info: public exception_detail::error_info_base { + error_info_base * + clone() const + { + return new error_info<Tag,T>(*this); + } public: - typedef T value_type; - - error_info( value_type const & value ); + error_info( value_type const & v ): + v_(v) + { + } +#if (__GNUC__*100+__GNUC_MINOR__!=406) //workaround for g++ bug #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - error_info( error_info const & ); - error_info( value_type && value ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(value)))); - error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.value_)))); + error_info( error_info const & x ): + v_(x.v_) + { + } + error_info( T && v ) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<T>::value): + v_(std::move(v)) + { + } + error_info( error_info && x ) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<T>::value): + v_(std::move(x.v_)) + { + } #endif - ~error_info() throw(); - +#endif + ~error_info() throw() + { + } value_type const & value() const { - return value_; + return v_; } - value_type & value() { - return value_; + return v_; } - private: error_info & operator=( error_info const & ); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES error_info & operator=( error_info && x ); #endif - std::string name_value_string() const; - - value_type value_; + value_type v_; }; } |