30 #ifndef _GLIBCXX_NESTED_EXCEPTION_H 31 #define _GLIBCXX_NESTED_EXCEPTION_H 1 33 #pragma GCC visibility push(default) 35 #if __cplusplus < 201103L 41 #if ATOMIC_INT_LOCK_FREE < 2 42 # error This platform does not support exception propagation. 70 rethrow_nested()
const 78 nested_ptr()
const noexcept
82 template<
typename _Except>
85 explicit _Nested_exception(
const _Except& __ex)
89 explicit _Nested_exception(_Except&& __ex)
90 : _Except(static_cast<_Except&&>(__ex))
94 template<
typename _Tp,
96 struct _Throw_with_nested_impl
98 template<
typename _Up>
99 static void _S_throw(_Up&& __t)
100 {
throw _Nested_exception<_Tp>{
static_cast<_Up&&
>(__t)}; }
103 template<
typename _Tp>
104 struct _Throw_with_nested_impl<_Tp, false>
106 template<
typename _Up>
107 static void _S_throw(_Up&& __t)
108 {
throw static_cast<_Up&&
>(__t); }
111 template<
typename _Tp,
bool = __is_
class(_Tp) && !__is_final(_Tp)>
112 struct _Throw_with_nested_helper : _Throw_with_nested_impl<_Tp>
115 template<
typename _Tp>
116 struct _Throw_with_nested_helper<_Tp, false>
117 : _Throw_with_nested_impl<_Tp, false>
120 template<
typename _Tp>
121 struct _Throw_with_nested_helper<_Tp&,
false>
122 : _Throw_with_nested_helper<_Tp>
125 template<
typename _Tp>
126 struct _Throw_with_nested_helper<_Tp&&,
false>
127 : _Throw_with_nested_helper<_Tp>
132 template<
typename _Tp>
137 _Throw_with_nested_helper<_Tp>::_S_throw(static_cast<_Tp&&>(__t));
140 template<
typename _Tp,
bool = __is_polymorphic(_Tp)>
141 struct _Rethrow_if_nested_impl
143 static void _S_rethrow(
const _Tp& __t)
145 if (
auto __tp = dynamic_cast<const nested_exception*>(&__t))
146 __tp->rethrow_nested();
150 template<
typename _Tp>
151 struct _Rethrow_if_nested_impl<_Tp, false>
153 static void _S_rethrow(
const _Tp&) { }
157 template<
typename _Ex>
161 _Rethrow_if_nested_impl<_Ex>::_S_rethrow(__ex);
171 #pragma GCC visibility pop 173 #endif // _GLIBCXX_NESTED_EXCEPTION_H exception_ptr current_exception() noexcept
void rethrow_exception(exception_ptr) __attribute__((__noreturn__))
Throw the object pointed to by the exception_ptr.
void terminate() noexcept __attribute__((__noreturn__))
void throw_with_nested(_Tp &&__t)
If __t is derived from nested_exception, throws __t. Else, throws an implementation-defined object de...
void rethrow_if_nested(const _Ex &__ex)
If __ex is derived from nested_exception, __ex.rethrow_nested().
Exception class with exception_ptr data member.
ISO C++ entities toplevel namespace is std.