30#ifndef _GLIBCXX_NESTED_EXCEPTION_H
31#define _GLIBCXX_NESTED_EXCEPTION_H 1
33#if __cplusplus < 201103L
42namespace std _GLIBCXX_VISIBILITY(default)
91 template<
typename _Except>
92 struct _Nested_exception :
public _Except,
public nested_exception
94 explicit _Nested_exception(
const _Except& __ex)
98 explicit _Nested_exception(_Except&& __ex)
99 : _Except(static_cast<_Except&&>(__ex))
103#if __cplusplus < 201703L || ! defined __cpp_if_constexpr
107 template<
typename _Tp>
110 __throw_with_nested_impl(_Tp&& __t,
true_type)
115 template<
typename _Tp>
118 __throw_with_nested_impl(_Tp&& __t,
false_type)
145 template<
typename _Tp>
150 using _Up =
typename decay<_Tp>::type;
153 static_assert(_CopyConstructible::value,
154 "throw_with_nested argument must be CopyConstructible");
156#if __cplusplus >= 201703L && __cpp_if_constexpr
169#if __cplusplus < 201703L || ! defined __cpp_if_constexpr
173 template<
typename _Ex>
175 __rethrow_if_nested_impl(
const _Ex* __ptr,
true_type)
177 if (
auto __ne_ptr =
dynamic_cast<const nested_exception*
>(__ptr))
178 __ne_ptr->rethrow_nested();
183 __rethrow_if_nested_impl(
const void*,
false_type)
203 template<
typename _Ex>
205 [[__gnu__::__always_inline__]]
211#if __cplusplus < 201703L || ! defined __cpp_if_constexpr
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
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)
void throw_with_nested(_Tp &&__t)
ISO C++ entities toplevel namespace is std.
An opaque pointer to an arbitrary exception.
void rethrow_nested() const
Rethrow the stored exception, or terminate if none was stored.
exception_ptr nested_ptr() const noexcept
Access the stored exception.
nested_exception() noexcept
The default constructor stores the current exception (if any).