在标准中,模板参数的语法在哪里定义,例如,'std::function<int(char)>'?
Where in the standard is the grammar for the template argument in, e.g., `std::function<int(char)>` defined?
只是出于好奇和教育原因,我试图在C++标准中找到它定义int(char)
std::function<int(char)>
有效的地方。搜索单词模板、参数、函数、函数类型等的任何排列并不是特别容易。我能放在一起的最好的定义是template instantiation template argument function type specifier
...
类型名称是一个声明,没有声明的名义事物的名称,就像可以在函数声明中显示为参数一样。模板参数可以是这样的类型 ID。
它在[decl.name]
中,作为type-id的产物之一
[ 示例:
int // int i int * // int *pi int *[3] // int *p[3] int (*)[3] // int (*p3i)[3] int *() // int *f() int (*)(double) // int (*pf)(double)
分别命名类型"
int
"、"指向int
的指针"、"指向int
的 3 个指针数组"、"指向 3 个int
数组的指针"、"返回指向int
的函数(无参数(的函数"和"指向 (double
( 返回int
的函数的指针"。— 结束示例 ]
int(char)
读作"(char
(返回int
的函数">
相关文章:
- 为什么在全局范围内使用"extern int a"似乎不行?
- int(c) 和 c-'0' 之间的区别。C++
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 为什么野牛仍在使用"int yylex(void)",却找不到"int yylex(YYS
- 有符号的int和int-有没有一种方法可以在C++中区分它们
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- 是否可以从int转换为enum类类型
- 不能在初始值设定项列表中将非常量表达式从类型 'int' 缩小到'unsigned long long'
- 向量 <int> a {N, 0} 和 int arr a[N] = {0} 的时间复杂度有什么区别
- 呼叫运营商<<临时
- 'short int'持有的值溢出,但"自动"不会溢出?
- 如何在C++中将一个无符号的 int 转换为两个无符号的短裤?
- 调用'begin(int [n])'没有匹配函数
- 错误:调用"std::vector<:vector<int>>::p ush_back(std::vector<std::__cxx11::basic_string<
- 为什么将此对向量&lt; map&lt; int,int&gt;&gt;中的地图进行更新.失败
- 如何加入向量&lt; int&gt;到C 中的单个INT
- 是numeric_limits&lt; int&gt; :: is_modulo从逻辑上矛盾
- 运营商&lt;&lt;无法访问班级的私人int
- std::pair的默认构造函数<>将基本类型(int等)设置为零
- 如何显示/打印字符串对象?cout & lt; & lt;Int工作,count <<字符串