31 #ifndef _EXCEPTION_PTR_H 32 #define _EXCEPTION_PTR_H 34 #pragma GCC visibility push(default) 52 namespace __exception_ptr
57 using __exception_ptr::exception_ptr;
65 template<typename _Ex>
71 namespace __exception_ptr
81 void* _M_exception_object;
85 void _M_addref() _GLIBCXX_USE_NOEXCEPT;
86 void _M_release() _GLIBCXX_USE_NOEXCEPT;
88 void *_M_get()
const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__));
92 template<
typename _Ex>
100 #if __cplusplus >= 201103L 102 : _M_exception_object(0)
106 : _M_exception_object(__o._M_exception_object)
107 { __o._M_exception_object = 0; }
110 #if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT) 120 #if __cplusplus >= 201103L 124 exception_ptr(static_cast<exception_ptr&&>(__o)).swap(*
this);
134 #ifdef _GLIBCXX_EH_PTR_COMPAT 136 void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT
137 __attribute__ ((__const__));
138 bool operator!()
const _GLIBCXX_USE_NOEXCEPT
139 __attribute__ ((__pure__));
140 operator __safe_bool()
const _GLIBCXX_USE_NOEXCEPT;
143 #if __cplusplus >= 201103L 144 explicit operator bool()
const 145 {
return _M_exception_object; }
150 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
153 __cxa_exception_type()
const _GLIBCXX_USE_NOEXCEPT
154 __attribute__ ((__pure__));
159 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
163 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
167 { __lhs.swap(__rhs); }
169 template<
typename _Ex>
171 __dest_thunk(
void* __x)
172 {
static_cast<_Ex*
>(__x)->~_Ex(); }
177 template<
typename _Ex>
181 #if __cpp_exceptions && __cpp_rtti && !_GLIBCXX_HAVE_CDTOR_CALLABI 182 void* __e = __cxxabiv1::__cxa_allocate_exception(
sizeof(_Ex));
183 (void) __cxxabiv1::__cxa_init_primary_exception(
184 __e, const_cast<std::type_info*>(&
typeid(__ex)),
185 __exception_ptr::__dest_thunk<_Ex>);
188 ::new (__e) _Ex(__ex);
193 __cxxabiv1::__cxa_free_exception(__e);
196 #elif __cpp_exceptions 205 #else // no RTTI and no exceptions 215 #pragma GCC visibility pop ISO C++ entities toplevel namespace is std.
void rethrow_exception(exception_ptr) __attribute__((__noreturn__))
Throw the object pointed to by the exception_ptr.
exception_ptr current_exception() noexcept
exception_ptr make_exception_ptr(_Ex) noexcept
Obtain an exception_ptr pointing to a copy of the supplied object.
An opaque pointer to an arbitrary exception.