Namespaces
Variants
Views
Actions

std::expected<T,E>::~expected

From cppreference.com
< cpp‎ | utility‎ | expected
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
constexpr ~expected();
(since C++23)

[edit] Main template destructor

Destroys the contained value:

  • If has_value() is true, destroys the expected value.
  • Otherwise, destroys the unexpected value.

This destructor is trivial if std::is_trivially_destructible_v<T> and std::is_trivially_destructible_v<E> are both true.

[edit] void partial specialization destructor

If has_value() is false, destroys the unexpected value.

This destructor is trivial if std::is_trivially_destructible_v<E> is true.

[edit] Example