std::is_move_constructible在C++中的应用与示例
C++ STL中的 std::is_move_constructible 模板出现在 <type_traits>
头文件中。C++ STL中的std::is_move_constructible模板用于检查T是否可以使用移动构造函数(可以使用其类型的右值引用构造)构造,返回bool类型的值,值为true或false。
头文件:
模板类:
语法:
参数: 模板 std::is_move_constructible 接受单个参数 T(特性类) ,以检查 T 是否为可移动构造类型。
返回值:
- 真: 如果给定的数据类型 T 是 is_move_constructible 。
- 假: 如果给定的数据类型 T 不是 is_move_constructible 。
下面是演示 std::is_move_constructible的 程序:
程序: