命名空间
变体
操作

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

来自 cppreference.cn
< cpp‎ | 工具库‎ | expected
 
 
 
 
constexpr ~expected();
(C++23 起)

[编辑] 主模板析构函数

销毁所包含的值

  • has_value()true,则销毁预期值。
  • 否则,销毁非预期值。

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

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

has_value()false,则销毁非预期值。

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

[编辑] 示例