It seems that we can optimize exception_ptr a bit without breaking ABI, given the internal implementation details actually use shared_ptr.
The following is possibly the full list but I'm not very sure.
- the default constructor and constructor from
nullptr_t can just rely on the default member initializers (initializing both internal pointer members to nullptr).
- the
swap function can just std::swap both pointer members.
- the
operator== can just compare _Data1 (which is equal to the result of get() of the internally reinterpreted shared).
- the assignment operator from
nullptr_t can swap *this with the empty exception_ptr first, which avoids one uninlined call to __ExceptionPtrAssign.
operator bool() can just return _Data1 != nullptr.
It seems that we can optimize
exception_ptra bit without breaking ABI, given the internal implementation details actually useshared_ptr.The following is possibly the full list but I'm not very sure.
nullptr_tcan just rely on the default member initializers (initializing both internal pointer members tonullptr).swapfunction can juststd::swapboth pointer members.operator==can just compare_Data1(which is equal to the result ofget()of the internally reinterpretedshared).nullptr_tcanswap*thiswith the emptyexception_ptrfirst, which avoids one uninlined call to__ExceptionPtrAssign.operator bool()can just return_Data1 != nullptr.