摘要: 一、概念(Concepts):为模板编程提供了更清晰的约束和检查机制。 template <typename T> concept Integral = std::is_integral_v<T>; // Integral约定类型T必须是整形 // std::is_integral_v<T> 等价于 阅读全文
posted @ 2024-04-11 17:40 fchy822 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 分类类型特征描述C++标准_v写法(C++17) 基本类型特性检查 std::is_same<T1, T2>::value 检查两个类型是否相同 C++11 std::is_same_v<T1, T2> std::is_integral<T>::value 检查T是否为整数类型 C++11 std: 阅读全文
posted @ 2024-04-11 14:52 fchy822 阅读(9) 评论(0) 推荐(0) 编辑