30#ifndef _GLIBCXX_NESTED_EXCEPTION_H
31#define _GLIBCXX_NESTED_EXCEPTION_H 1
33#pragma GCC visibility push(default)
35#if __cplusplus < 201103L
67 rethrow_nested()
const
75 nested_ptr()
const noexcept
81 template<
typename _Except>
84 explicit _Nested_exception(
const _Except& __ex)
88 explicit _Nested_exception(_Except&& __ex)
89 : _Except(static_cast<_Except&&>(__ex))
96 template<
typename _Tp>
99 __throw_with_nested_impl(_Tp&& __t,
true_type)
101 using _Up =
typename remove_reference<_Tp>::type;
102 throw _Nested_exception<_Up>{std::forward<_Tp>(__t)};
105 template<
typename _Tp>
108 __throw_with_nested_impl(_Tp&& __t,
false_type)
109 {
throw std::forward<_Tp>(__t); }
115 template<
typename _Tp>
120 using _Up =
typename decay<_Tp>::type;
121 using _CopyConstructible
123 static_assert(_CopyConstructible::value,
124 "throw_with_nested argument must be CopyConstructible");
125 using __nest = __and_<is_class<_Up>, __bool_constant<!__is_final(_Up)>,
126 __not_<is_base_of<nested_exception, _Up>>>;
127 std::__throw_with_nested_impl(std::forward<_Tp>(__t), __nest{});
133 template<
typename _Tp>
134 using __rethrow_if_nested_cond =
typename enable_if<
135 __and_<is_polymorphic<_Tp>,
136 __or_<__not_<is_base_of<nested_exception, _Tp>>,
137 is_convertible<_Tp*, nested_exception*>>>::value
141 template<
typename _Ex>
142 inline __rethrow_if_nested_cond<_Ex>
143 __rethrow_if_nested_impl(
const _Ex* __ptr)
145 if (
auto __ne_ptr =
dynamic_cast<const nested_exception*
>(__ptr))
146 __ne_ptr->rethrow_nested();
151 __rethrow_if_nested_impl(
const void*)
157 template<
typename _Ex>
169#pragma GCC visibility pop
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
exception_ptr current_exception() noexcept
void rethrow_exception(exception_ptr)
Throw the object pointed to by the exception_ptr.
void terminate() noexcept
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...
ISO C++ entities toplevel namespace is std.
An opaque pointer to an arbitrary exception.
Exception class with exception_ptr data member.