std::destructible (C++20 起)

来自cppreference.com
< cpp‎ | concepts
在标头 <concepts> 定义
template< class T >
concept destructible = std::is_nothrow_destructible_v<T>;
(C++20 起)

概念 destructible 指定能在实例生存期结尾安全销毁的所有类型(包含引用类型)的概念。

注解

不同于 可析构 (Destructible) 具名要求,std::destructible 要求析构函数为 noexcept(true),而不仅是调用时不抛出,并且允许引用类型和数组类型。

引用

  • C++23 标准(ISO/IEC 14882:2024):
  • 18.4.10 Concept destructible [concept.destructible]
  • C++20 标准(ISO/IEC 14882:2020):
  • 18.4.10 Concept destructible [concept.destructible]

参阅

检查类型是否拥有未被弃置的析构函数
(类模板)