30 #ifndef _GLIBCXX_NESTED_EXCEPTION_H
31 #define _GLIBCXX_NESTED_EXCEPTION_H 1
33 #pragma GCC visibility push(default)
35 #if __cplusplus < 201103L
65 rethrow_nested()
const __attribute__ ((__noreturn__))
73 template<
typename _Except>
76 explicit _Nested_exception(_Except&& __ex)
77 : _Except(static_cast<_Except&&>(__ex))
81 template<
typename _Ex>
82 struct __get_nested_helper
84 static const nested_exception*
85 _S_get(
const _Ex& __ex)
86 {
return dynamic_cast<const nested_exception*
>(&__ex); }
89 template<
typename _Ex>
90 struct __get_nested_helper<_Ex*>
92 static const nested_exception*
93 _S_get(
const _Ex* __ex)
94 {
return dynamic_cast<const nested_exception*
>(__ex); }
97 template<
typename _Ex>
98 inline const nested_exception*
99 __get_nested_exception(
const _Ex& __ex)
100 {
return __get_nested_helper<_Ex>::_S_get(__ex); }
102 template<
typename _Ex>
104 __throw_with_nested(_Ex&&,
const nested_exception* = 0)
105 __attribute__ ((__noreturn__));
107 template<typename _Ex>
109 __throw_with_nested(_Ex&&, ...) __attribute__ ((__noreturn__));
114 template<typename _Ex>
116 __throw_with_nested(_Ex&& __ex, const nested_exception*)
119 template<
typename _Ex>
121 __throw_with_nested(_Ex&& __ex, ...)
122 {
throw _Nested_exception<_Ex>(
static_cast<_Ex&&
>(__ex)); }
124 template<
typename _Ex>
130 template<
typename _Ex>
134 if (__get_nested_exception(__ex))
136 __throw_with_nested(static_cast<_Ex&&>(__ex), &__ex);
140 template<
typename _Ex>
145 __nested->rethrow_nested();
151 { __ex.rethrow_nested(); }
160 #pragma GCC visibility pop
162 #endif // _GLIBCXX_NESTED_EXCEPTION_H
Exception class with exception_ptr data member.
exception_ptr current_exception() noexcept
void rethrow_if_nested(const _Ex &__ex)
If __ex is derived from nested_exception, __ex.rethrow_nested().
ISO C++ entities toplevel namespace is std.
void rethrow_exception(exception_ptr) __attribute__((__noreturn__))
Throw the object pointed to by the exception_ptr.
void throw_with_nested(_Ex __ex) __attribute__((__noreturn__))
If __ex is derived from nested_exception, __ex. Else, an implementation-defined object derived from b...