30 #ifndef _GLIBCXX_NESTED_EXCEPTION_H 31 #define _GLIBCXX_NESTED_EXCEPTION_H 1 33 #pragma GCC visibility push(default) 35 #if __cplusplus < 201103L 66 rethrow_nested()
const 74 nested_ptr()
const noexcept
78 template<
typename _Except>
81 explicit _Nested_exception(
const _Except& __ex)
85 explicit _Nested_exception(_Except&& __ex)
86 : _Except(static_cast<_Except&&>(__ex))
90 template<
typename _Tp,
91 bool __with_nested = !__is_base_of(nested_exception, _Tp)>
92 struct _Throw_with_nested_impl
94 template<
typename _Up>
95 static void _S_throw(_Up&& __t)
96 {
throw _Nested_exception<_Tp>{
static_cast<_Up&&
>(__t)}; }
99 template<
typename _Tp>
100 struct _Throw_with_nested_impl<_Tp, false>
102 template<
typename _Up>
103 static void _S_throw(_Up&& __t)
104 {
throw static_cast<_Up&&
>(__t); }
107 template<
typename _Tp,
bool = __is_
class(_Tp) && !__is_final(_Tp)>
108 struct _Throw_with_nested_helper : _Throw_with_nested_impl<_Tp>
111 template<
typename _Tp>
112 struct _Throw_with_nested_helper<_Tp, false>
113 : _Throw_with_nested_impl<_Tp, false>
116 template<
typename _Tp>
117 struct _Throw_with_nested_helper<_Tp&,
false>
118 : _Throw_with_nested_helper<_Tp>
121 template<
typename _Tp>
122 struct _Throw_with_nested_helper<_Tp&&,
false>
123 : _Throw_with_nested_helper<_Tp>
128 template<
typename _Tp>
133 _Throw_with_nested_helper<_Tp>::_S_throw(static_cast<_Tp&&>(__t));
136 template<
typename _Tp,
bool = __is_polymorphic(_Tp)>
137 struct _Rethrow_if_nested_impl
139 static void _S_rethrow(
const _Tp& __t)
141 if (
auto __tp = dynamic_cast<const nested_exception*>(&__t))
142 __tp->rethrow_nested();
146 template<
typename _Tp>
147 struct _Rethrow_if_nested_impl<_Tp, false>
149 static void _S_rethrow(
const _Tp&) { }
153 template<
typename _Ex>
157 _Rethrow_if_nested_impl<_Ex>::_S_rethrow(__ex);
167 #pragma GCC visibility pop 169 #endif // _GLIBCXX_NESTED_EXCEPTION_H void rethrow_exception(exception_ptr) __attribute__((__noreturn__))
Throw the object pointed to by the exception_ptr.
void terminate() noexcept __attribute__((__noreturn__))
An opaque pointer to an arbitrary exception.
ISO C++ entities toplevel namespace is std.
void rethrow_if_nested(const _Ex &__ex)
If __ex is derived from nested_exception, __ex.rethrow_nested().
void throw_with_nested(_Tp &&__t)
If __t is derived from nested_exception, throws __t. Else, throws an implementation-defined object de...
exception_ptr current_exception() noexcept
Exception class with exception_ptr data member.