| 93 | |
| 94 | template <class Ex> |
| 95 | class exception final: |
| 96 | public Ex, |
| 97 | public exception_base, |
| 98 | public error_id |
| 99 | { |
| 100 | mutable bool clear_current_error_; |
| 101 | |
| 102 | bool is_current_exception() const noexcept |
| 103 | { |
| 104 | return tls::read_current_error_id() == unsigned(error_id::value()); |
| 105 | } |
| 106 | |
| 107 | error_id get_error_id() const noexcept override |
| 108 | { |
| 109 | clear_current_error_ = false; |
| 110 | return *this; |
| 111 | } |
| 112 | |
| 113 | detail::type_name get_type_name() const override |
| 114 | { |
| 115 | return detail::get_type_name<Ex>(); |
| 116 | } |
| 117 | |
| 118 | public: |
| 119 | |
| 120 | exception( exception const & other ): |
| 121 | Ex(other), |
| 122 | exception_base(other), |
| 123 | error_id(other), |
| 124 | clear_current_error_(other.clear_current_error_) |
| 125 | { |
| 126 | other.clear_current_error_ = false; |
| 127 | } |
| 128 | |
| 129 | exception( exception && other ) noexcept: |
| 130 | Ex(std::move(other)), |
| 131 | exception_base(std::move(other)), |
| 132 | error_id(std::move(other)), |
| 133 | clear_current_error_(std::move(other.clear_current_error_)) |
| 134 | { |
| 135 | other.clear_current_error_ = false; |
| 136 | } |
| 137 | |
| 138 | exception( error_id id, Ex const & ex ) noexcept: |
| 139 | Ex(ex), |
| 140 | error_id(id), |
| 141 | clear_current_error_(true) |
| 142 | { |
| 143 | enforce_std_exception(*this); |
| 144 | } |
| 145 | |
| 146 | exception( error_id id, Ex && ex ) noexcept: |
| 147 | Ex(std::move(ex)), |
| 148 | error_id(id), |
| 149 | clear_current_error_(true) |
| 150 | { |
| 151 | enforce_std_exception(*this); |
| 152 | } |
no outgoing calls