31#ifndef _EXCEPTION_PTR_H
32#define _EXCEPTION_PTR_H
34#pragma GCC visibility push(default)
42#if __cplusplus >= 201103L
46#ifdef _GLIBCXX_EH_PTR_RELOPS_COMPAT
47# define _GLIBCXX_EH_PTR_USED __attribute__((__used__))
49# define _GLIBCXX_EH_PTR_USED
63 namespace __exception_ptr
68 using __exception_ptr::exception_ptr;
76 template<typename _Ex>
82 namespace __exception_ptr
92 void* _M_exception_object;
96 void _M_addref() _GLIBCXX_USE_NOEXCEPT;
97 void _M_release() _GLIBCXX_USE_NOEXCEPT;
99 void *_M_get()
const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__));
103 template<
typename _Ex>
111#if __cplusplus >= 201103L
113 : _M_exception_object(
nullptr)
117 : _M_exception_object(__o._M_exception_object)
118 { __o._M_exception_object =
nullptr; }
121#if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT)
131#if __cplusplus >= 201103L
145#ifdef _GLIBCXX_EH_PTR_COMPAT
147 void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT
148 __attribute__ ((__const__));
149 bool operator!()
const _GLIBCXX_USE_NOEXCEPT
150 __attribute__ ((__pure__));
151 operator __safe_bool()
const _GLIBCXX_USE_NOEXCEPT;
154#if __cplusplus >= 201103L
155 explicit operator bool()
const noexcept
156 {
return _M_exception_object; }
159#if __cpp_impl_three_way_comparison >= 201907L \
160 && ! defined _GLIBCXX_EH_PTR_RELOPS_COMPAT
164 friend _GLIBCXX_EH_PTR_USED
bool
166 _GLIBCXX_USE_NOEXCEPT
167 {
return __x._M_exception_object == __y._M_exception_object; }
169 friend _GLIBCXX_EH_PTR_USED
bool
171 _GLIBCXX_USE_NOEXCEPT
172 {
return __x._M_exception_object != __y._M_exception_object; }
176 __cxa_exception_type()
const _GLIBCXX_USE_NOEXCEPT
177 __attribute__ ((__pure__));
182 exception_ptr::exception_ptr() _GLIBCXX_USE_NOEXCEPT
183 : _M_exception_object(0)
189 _GLIBCXX_USE_NOEXCEPT
190 : _M_exception_object(__other._M_exception_object)
192 if (_M_exception_object)
198 exception_ptr::~exception_ptr() _GLIBCXX_USE_NOEXCEPT
200 if (_M_exception_object)
205 inline exception_ptr&
206 exception_ptr::operator=(
const exception_ptr& __other) _GLIBCXX_USE_NOEXCEPT
208 exception_ptr(__other).swap(*
this);
214 exception_ptr::swap(exception_ptr &__other) _GLIBCXX_USE_NOEXCEPT
216 void *__tmp = _M_exception_object;
217 _M_exception_object = __other._M_exception_object;
218 __other._M_exception_object = __tmp;
223 swap(exception_ptr& __lhs, exception_ptr& __rhs)
224 { __lhs.swap(__rhs); }
227 template<
typename _Ex>
229 __dest_thunk(
void* __x)
230 {
static_cast<_Ex*
>(__x)->~_Ex(); }
236 template<
typename _Ex>
240#if __cpp_exceptions && __cpp_rtti && !_GLIBCXX_HAVE_CDTOR_CALLABI \
241 && __cplusplus >= 201103L
242 using _Ex2 =
typename remove_reference<_Ex>::type;
243 void* __e = __cxxabiv1::__cxa_allocate_exception(
sizeof(_Ex));
244 (void) __cxxabiv1::__cxa_init_primary_exception(
246 __exception_ptr::__dest_thunk<_Ex2>);
249 ::new (__e) _Ex2(std::forward<_Ex>(__ex));
254 __cxxabiv1::__cxa_free_exception(__e);
257#elif __cpp_exceptions
271#undef _GLIBCXX_EH_PTR_USED
278#pragma GCC visibility pop
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
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.