Namespaces
Variants

std:: constructible_from

From cppreference.net
定义于头文件 <concepts>
template < class T, class ... Args >

concept constructible_from =

std:: destructible < T > && std:: is_constructible_v < T, Args... > ;
(C++20 起)

constructible_from 概念规定类型 T 的变量可以使用给定的参数类型集合 Args... 进行初始化。

参考文献

  • C++23 标准 (ISO/IEC 14882:2024):
  • 18.4.11 概念 constructible_from [concept.constructible]
  • C++20 标准 (ISO/IEC 14882:2020):
  • 18.4.11 概念 constructible_from [concept.constructible]

参见

检查类型是否具有特定参数的构造函数
(类模板)