33 exception_dispatch_info() =
default;
41 [[nodiscard]]
auto captured() const noexcept ->
bool {
return exception_ptr_ ? true :
false;}
57 template<
typename exception_t>
58 [[nodiscard]]
static auto capture(
const exception_t& source) -> exception_dispatch_info {
59 return exception_dispatch_info {source};
65 [[nodiscard]]
static auto capture() -> exception_dispatch_info {
66 return exception_dispatch_info {std::current_exception()};
72 template<
typename exception_t>
73 static auto rethrow(
const exception_t& source) ->
void {exception_dispatch_info {source}.rethrow();}
81 explicit operator bool () const noexcept {
return captured();}
82 operator const std::exception_ptr& ()
const noexcept {
return exception_ptr_;}
83 operator std::exception_ptr () noexcept {
return exception_ptr_;}
87 template<
typename exception_t>
88 explicit exception_dispatch_info(
const exception_t& source) : source_ {
xtd::
new_ptr<exception_t>(source)}, exception_ptr_ {std::make_exception_ptr(source)} {}
89 explicit exception_dispatch_info(
const std::exception_ptr& exception_ptr) : exception_ptr_ {exception_ptr} {}
92 std::exception_ptr exception_ptr_;
auto captured() const noexcept -> bool
Gets a value indicating whether the exception is caught or not.
Definition exception_dispatch_info.hpp:41
static auto capture(const exception_t &source) -> exception_dispatch_info
Creates an xtd::exception_services::exception_dispatch_info object that represents the specified exce...
Definition exception_dispatch_info.hpp:58
static auto capture() -> exception_dispatch_info
Creates an xtd::exception_services::exception_dispatch_info object that represents the specified exce...
Definition exception_dispatch_info.hpp:65
auto rethrow() -> void
Rethrows the exception that's represented by the current xtd::exception_services::exception_dispatch_...
Definition exception_dispatch_info.hpp:70
static auto rethrow(const exception_t &source) -> void
Rehrows the source exception, maintaining the original stack trace information.
Definition exception_dispatch_info.hpp:73
auto source_exception() const noexcept -> xtd::ptr< std::exception >
Gets the exception that's represented by the current instance.
Definition exception_dispatch_info.hpp:46
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.hpp:34
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Contains xtd::exception exception.
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
auto new_ptr(args_t &&... args) -> xtd::ptr< type_t >
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
Provides classes for advanced exception handling.
Definition exception_dispatch_info.hpp:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8