change support python version
[platform/upstream/boost.git] / boost / exception / detail / error_info_impl.hpp
1 //Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
2
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef UUID_CE6983AC753411DDA764247956D89593
7 #define UUID_CE6983AC753411DDA764247956D89593
8
9 #include <boost/config.hpp>
10 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
11 #include <boost/type_traits/is_nothrow_move_constructible.hpp>
12 #endif
13 #include <utility>
14 #include <string>
15
16 #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
17 #pragma GCC system_header
18 #endif
19 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
20 #pragma warning(push,1)
21 #endif
22
23 namespace
24 boost
25     {
26     namespace
27     exception_detail
28         {
29         class
30         error_info_base
31             {
32             public:
33
34             virtual std::string name_value_string() const = 0;
35             virtual error_info_base * clone() const = 0;
36
37             virtual
38             ~error_info_base() BOOST_NOEXCEPT_OR_NOTHROW
39                 {
40                 }
41             };
42         }
43
44     template <class Tag,class T>
45     class
46     error_info:
47         public exception_detail::error_info_base
48         {
49         exception_detail::error_info_base *
50         clone() const
51             {
52             return new error_info<Tag,T>(*this);
53             }
54         public:
55         typedef T value_type;
56         error_info( value_type const & v ):
57             v_(v)
58             {
59             }
60 #if (__GNUC__*100+__GNUC_MINOR__!=406) //workaround for g++ bug
61 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
62         error_info( error_info const & x ):
63             v_(x.v_)
64             {
65             }
66         error_info( T && v ) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<T>::value):
67             v_(std::move(v))
68             {
69             }
70         error_info( error_info && x ) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<T>::value):
71             v_(std::move(x.v_))
72             {
73             }
74 #endif
75 #endif
76         ~error_info() BOOST_NOEXCEPT_OR_NOTHROW
77             {
78             }
79         value_type const &
80         value() const
81             {
82             return v_;
83             }
84         value_type &
85         value()
86             {
87             return v_;
88             }
89         private:
90         error_info & operator=( error_info const & );
91 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
92         error_info & operator=( error_info && x );
93 #endif
94         std::string name_value_string() const;
95         value_type v_;
96         };
97     }
98
99 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
100 #pragma warning(pop)
101 #endif
102 #endif