命名空间
变体
操作

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

来自 cppreference.cn
< cpp‎ | utility‎ | expected
 
 
 
 
constexpr ~expected();
(since C++23)

[编辑] 主模板析构函数

销毁包含的值

  • 如果 has_value()true,则销毁 expected 值。
  • 否则,销毁 unexpected 值。

如果 std::is_trivially_destructible_v<T>std::is_trivially_destructible_v<E> 均为 true,则此析构函数是平凡的。

[编辑] void 部分特化析构函数

如果 has_value()false,则销毁 unexpected 值。

如果 std::is_trivially_destructible_v<E>true,则此析构函数是平凡的。

[编辑] 示例