31 #ifndef _EXCEPTION_PTR_H
32 #define _EXCEPTION_PTR_H
34 #pragma GCC visibility push(default)
42 #if __cplusplus >= 201103L
57 namespace __exception_ptr
62 using __exception_ptr::exception_ptr;
70 template<typename _Ex>
76 namespace __exception_ptr
86 void* _M_exception_object;
90 void _M_addref() _GLIBCXX_USE_NOEXCEPT;
91 void _M_release() _GLIBCXX_USE_NOEXCEPT;
93 void *_M_get()
const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__));
97 template<
typename _Ex>
105 #if __cplusplus >= 201103L
107 : _M_exception_object(0)
111 : _M_exception_object(__o._M_exception_object)
112 { __o._M_exception_object = 0; }
115 #if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT)
125 #if __cplusplus >= 201103L
139 #ifdef _GLIBCXX_EH_PTR_COMPAT
141 void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT
142 __attribute__ ((__const__));
143 bool operator!()
const _GLIBCXX_USE_NOEXCEPT
144 __attribute__ ((__pure__));
145 operator __safe_bool()
const _GLIBCXX_USE_NOEXCEPT;
148 #if __cplusplus >= 201103L
149 explicit operator bool()
const
150 {
return _M_exception_object; }
155 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
158 __cxa_exception_type()
const _GLIBCXX_USE_NOEXCEPT
159 __attribute__ ((__pure__));
166 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
170 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
174 { __lhs.swap(__rhs); }
179 template<
typename _Ex>
181 __dest_thunk(
void* __x)
182 {
static_cast<_Ex*
>(__x)->~_Ex(); }
188 template<
typename _Ex>
192 #if __cpp_exceptions && __cpp_rtti && !_GLIBCXX_HAVE_CDTOR_CALLABI \
193 && __cplusplus >= 201103L
194 using _Ex2 =
typename remove_reference<_Ex>::type;
195 void* __e = __cxxabiv1::__cxa_allocate_exception(
sizeof(_Ex));
196 (void) __cxxabiv1::__cxa_init_primary_exception(
198 __exception_ptr::__dest_thunk<_Ex2>);
201 ::new (__e) _Ex2(std::forward<_Ex>(__ex));
206 __cxxabiv1::__cxa_free_exception(__e);
209 #elif __cpp_exceptions
228 #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)
Throw the object pointed to by the exception_ptr.
ISO C++ entities toplevel namespace is std.
An opaque pointer to an arbitrary exception.