31#ifndef _EXCEPTION_PTR_H
32#define _EXCEPTION_PTR_H
34#pragma GCC visibility push(default)
42#if __cplusplus >= 201103L
56 namespace __exception_ptr
61 using __exception_ptr::exception_ptr;
69 template<typename _Ex>
75 namespace __exception_ptr
85 void* _M_exception_object;
89 void _M_addref() _GLIBCXX_USE_NOEXCEPT;
90 void _M_release() _GLIBCXX_USE_NOEXCEPT;
92 void *_M_get()
const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__));
96 template<
typename _Ex>
104#if __cplusplus >= 201103L
106 : _M_exception_object(0)
110 : _M_exception_object(__o._M_exception_object)
111 { __o._M_exception_object = 0; }
114#if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT)
124#if __cplusplus >= 201103L
138#ifdef _GLIBCXX_EH_PTR_COMPAT
140 void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT
141 __attribute__ ((__const__));
142 bool operator!()
const _GLIBCXX_USE_NOEXCEPT
143 __attribute__ ((__pure__));
144 operator __safe_bool()
const _GLIBCXX_USE_NOEXCEPT;
147#if __cplusplus >= 201103L
148 explicit operator bool()
const
149 {
return _M_exception_object; }
154 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
157 __cxa_exception_type()
const _GLIBCXX_USE_NOEXCEPT
158 __attribute__ ((__pure__));
163 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
167 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
171 { __lhs.swap(__rhs); }
173 template<
typename _Ex>
175 __dest_thunk(
void* __x)
176 {
static_cast<_Ex*
>(__x)->~_Ex(); }
181 template<
typename _Ex>
185#if __cpp_exceptions && __cpp_rtti && !_GLIBCXX_HAVE_CDTOR_CALLABI \
186 && __cplusplus >= 201103L
187 using _Ex2 =
typename remove_reference<_Ex>::type;
188 void* __e = __cxxabiv1::__cxa_allocate_exception(
sizeof(_Ex));
189 (void) __cxxabiv1::__cxa_init_primary_exception(
191 __exception_ptr::__dest_thunk<_Ex2>);
194 ::new (__e) _Ex2(std::forward<_Ex>(__ex));
199 __cxxabiv1::__cxa_free_exception(__e);
202#elif __cpp_exceptions
221#pragma GCC visibility pop
exception_ptr current_exception() noexcept
exception_ptr make_exception_ptr(_Ex) noexcept
Obtain an exception_ptr pointing to a copy of the supplied object.
void rethrow_exception(exception_ptr) __attribute__((__noreturn__))
Throw the object pointed to by the exception_ptr.
ISO C++ entities toplevel namespace is std.
An opaque pointer to an arbitrary exception.