使用示例中的C++ std::is_trivially_move_constructible
C++ STL中的 std::is_trivially_move_constructible 模板出现在 < type_traits>头文件中。C++ STL的 std::is_trivially_move_constructible 模板用于检查 T 是否是可平凡移动构造的。如果 T 是可平凡移动构造类型,则返回布尔值true,否则返回false。
头文件:
模板类:
语法:
参数: 模板 std::is_trivially_move_constructible 接受单个参数 T(特征类) ,以检查 T 是否是可平凡移动构造类型。
返回值: 模板 std::is_trivially_move_constructible 返回布尔变量,如下所示:
- 真: 如果类型 T 是可平凡移动构造的,则返回true。
- 假: 如果类型 T 不是可平凡移动构造的,则返回false。
下面的程序演示了如何在C++中使用 std::is_trivially_move_constructible :
程序1:
程序2: