std::expected::~expected(3)
π NAME π
std::expected::~expected β bestie, it's literally the destructor for std::expected, and yes the name is a whole mood: std::expected::~expected π
πΈ SYNOPSIS πΈ
constexpr ~expected(); (since C++23)
Ok so this is the cleanup girlie, and she's been around since C++23 β¨
π¦ DESCRIPTION π¦
So what does this destructor actually do? It destroys the currently contained value. That's the whole vibe. But which value? Depends on what's inside, bestie:
- If
has_value()isfalse, it destroys the unexpected value π«Ά - Otherwise, if
Tis not (possibly cv-qualified)void, it destroys the expected value π
No cap, that's it. It's giving "know what you're holding and clean it up accordingly."
β¨ when is this destructor trivial? β¨
This destructor is trivial if both of these are true:
- either
Tis (possibly cv-qualified)void, orstd::is_trivially_destructible_v<T>istrue, and std::is_trivially_destructible_v<E>istrueπ₯
Read that carefully, bestie β it's an "either/or" situation for T, and then an "and" for E. The way that trivial-destructor condition is structured? Iconic. Don't fumble it π
π EXAMPLE π
This section is incomplete. Reason: no example.
Yeahβ¦ no example yet π It literally says "no example." We're not gonna invent one, that would be a whole lie. Category says it all:
- Todo no example
π§ CATEGORY π§
- Todo no example
and that's the whole page, bestie β¨ This little gem came from http://cppreference.com, dated 2024.06.10, and it's filed under std::expected::~expected(3). Go forth and destruct responsibly ππ¦
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms