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

> C++ Atlas: `cppatlas.com/w/cpp/utility/expected/~expected` | Source: https://en.cppreference.com/w/cpp/utility/expected/~expected | Domain: Utility | Standards: C++23

Destroys the contained value:

## Official Specification Summary (cppreference)

```cpp
constexpr ~expected(); // (since C++23)
```

### 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`.

### `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`.

### Example

> Note: This section is incomplete Reason: no example

---
Attribution: content from https://en.cppreference.com/w/cpp/utility/expected/~expected (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.