std::exception_ptr_cast
From cppreference.com
| Defined in header <exception>
|
||
template< class E >
constexpr std::optional<const E&>
exception_ptr_cast( const std::exception_ptr& ptr ) noexcept;
|
(since C++26) | |
Attempts to match the exception object referred to by ptr with const E&, and returns a reference to the matched exception object.
Parameters
| ptr | - | the target std::exception_ptr object |
Return value
If ptr is not null and a handler of type const E& is a match for the exception object referred to by ptr, returns an std::optional<const E&> object containing a reference to the exception object. Otherwise returns std::nullopt.
Notes
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_exception_ptr_cast |
202603L |
(C++26) | std::exception_ptr_cast
|
Example
| This section is incomplete Reason: no example |
See also
(C++11) |
creates an std::exception_ptr from an exception object (function template) |
(C++11) |
captures the current exception in an std::exception_ptr (function) |