C++ 非类型模板参数 : Is typedef of an integral type an integral type?

标签 c++ templates parameters typedef

我知道我可以做功能模板template<int N> void f () {} .

但是template<std::size_t N> void f() {}呢? ?

最佳答案

typedef 只是给定类型的别名。所以任何整数类型的 typedef 本身就是一个整数类型。并且类型没有比 std::size_t 更完整。

关于C++ 非类型模板参数 : Is typedef of an integral type an integral type?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18406070/

相关文章:

c++ - 告诉 VS2010 折叠区域

c++ - 我如何编写用于字符串的双哈希实现?

C++ : 2D array by reference? 这个函数为什么起作用

c# - 为什么要使用 params 关键字?

swift - 是否可以有多个参数选择?

c++ - OpenCL 找不到 Intel HD 4000

c++ - 无法找出这个内存错误(程序完成后崩溃)

string - ExtJS 如何从字符串动态创建小部件和布局

php - 将动态值插入特定 WooCommerce 电子邮件模板的文本字符串中

c - 传递数组而不是指向 C 中函数的指针