roc绘制,ros c语言
饭桶克隆https://github.com/changkun/modern-cpp-tutorial.git
coliru.stacked-crooked.com
外部模板
#包括输入输出流
#包含矢量
模板类STD:vector布尔;//strong制实例化
走读生模板类STD:vector double;//避免在此文件中实例化的外部模板
模板布尔T类MagicType {
bool magic=T;
};
int main() {
//模板中的
标准:向量标准:向量整数矩阵;
STD:向量魔法类型(1 ^ 2)魔法;//合法,但不推荐
} g-STD=c 17 2.12。外部的。模板。CPP-o外部温度
注意:
尖括号" "
标准:向量标准:向量整数矩阵;不加-std=c 17,按传统c模式,比如错误:
编译器会给出提示的:
2.12 .外部的。模板。CPP:17:18:警告:非静态数据成员初始值设定项仅适用于-std=c 11或-std=gnu 11
类型别名模板
#包括输入输出流
#包含矢量
#包含字符串
模板类型名t,类型名U
魔法定义类{
公共:
t暗;
u魔法
};
//非法
//模板类型名T
//typedef MagicType std:vector T,STD:string fakedarkmacid;
typedef int(* process)(void *);
使用new process=int(*)(void *);
模板类型名T
使用真黑魔法=魔法类型STD:vector T,STD:string;
int main() {
//fakedarkmarctic bool
TrueDarkMagic bool你
} g-STD=c 17 2.13。别名。模板。CPP-o altemp
模板求和:
#包括输入输出流
模板类型名T=int,类型名U=int
自动添加(T x,U y)删除类型(x y) {
返回x y;
}
int main() {
std:cout add(1,2)STD:endl;
} g-STD=c 17 2.14。默认。模板。参数。CPP-o检测
变长参数模板
#包括输入输出流
#包含矢量
#包含字符串
//sizeof.
模板类型名.分时(同分时)
虚空魔法(Ts.args) {
std:cout sizeof.(args)STD:endl;
}
//1.递归参数解包
模板类型名T0
作废打印f1(T0值){
标准:cout值STD:endl;
}
模板类型名t,类型名.分时(同分时)
无效打印f1(T值,Ts.args) {
标准:cout值STD:endl;
打印f1(参数.);
}
//2.可变模板参数展开
模板类型名T0,类型名.T
无效打印f2(T0 t0,T.t) {
STD:cout t0 STD:endl;
if constexpr (sizeof.(t) 0)打印f2(t.);
}
//3.使用初始值设定项列表解包参数
模板类型名t,类型名.分时(同分时)
自动打印f3(T值,Ts.args) {
标准:cout值STD:endl;
(void)STD:initializer _ list T {([args]{
STD:cout args STD:endl;
}(),值).};
}
int main() {
magic();
魔术(1);
魔法(1, );
printf1(1,2, 123 ,1.1);
printf2(1,2.3, ABC );
printf3(111,123, alpha ,1.2);
返回0;
}
折叠表达式
#包括输入输出流
模板类型名.T
自动求和(T.t) {
返回(t.);
}
int main() {
std:cout sum(1,2,3,4,5,6,7,8,9,10)STD:endl;
}
非类型模板参数推导
#包括输入输出流
模板自动赋值void foo() {
标准:cout值STD:endl;
返回;
}
int main() {
foo 10();//值被推断为(同Internationalorganizations)国际组织类型
}
石燕楼:2/(主)$ g-STD=c 17 2.12。外部的。模板。CPP-o外部温度
石燕楼:2/(师傅*) $。/外部温度[14:39:12]
石燕楼:2/(主*)$ g 2.12。外部的。模板。CPP-o外部温度[14:39:16]
2.12 .外部的。模板。CPP:17:18:警告:非静态数据成员初始值设定项仅适用于-std=c 11或-std=gnu 11
bool magic=T;
^
2.12 .外部的。模板。CPP:In function \ u 2018 int main()\ u 2019:
2.12 .外部的。模板。CPP:22:32:错误:\u2018 \u2019应该在嵌套模板参数列表中
标准:向量标准:向量整数矩阵;
^
2.12 .外部的。模板。CPP:23:35:错误:\u2018magic\u2019未在此范围内声明
STD:向量魔法类型(1 ^ 2)魔法;//合法,但不推荐
^
2.12 .外部的。模板。CPP:23:35:错误:模板参数一无效
2.12 .外部的。模板。CPP:23:17:错误:模板参数一无效
STD:向量魔法类型(1 ^ 2)魔法;//合法,但不推荐
^
2.12 .外部的。模板。CPP:23:17:错误:模板参数2无效
石燕楼:2/(master *)$ g-STD=c 17 2.13。别名。模板。CPP-o altemp
石燕楼:2/(师傅*) $。/altemp [14:46:30]
石燕楼:2/(master *)$ g-STD=c 17 2.14。默认。模板。参数。CPP-o检测
石燕楼:2/(师傅*) $。/detemp [14:51:33]
3
石燕楼:2/(master *)$ g-STD=c 17 2.15。多变的。模板。参数。CPP-o可变温度
2.15 .多变的。模板。参数。CPP:在函数\ u 2018无效打印f2(T0,T.)\u2019:
2.15 .多变的。模板。参数。CPP:36:8:错误:应为\ u 2018(\ u 2019之前\ u 2018 const expr \ u 2019
if constexpr (sizeof.(t) 0)打印f2(t.);
^
2.15 .多变的。模板。参数。CPP:在函数中\ u 2018自动打印f3(T,Ts.)\u2019:
2.15 .多变的。模板。参数。CPP:43:40:错误:参数包没有用\u2018扩展.\u2019:
(void)STD:initializer _ list T {([args]{
^
2.15 .多变的。模板。参数。CPP:43:40:注意:\u2018args\u2019
2.15 .多变的。模板。参数。CPP:43:44:错误:参数包没有用\u2018扩展.\u2019:
(void)STD:initializer _ list T {([args]{
^
2.15 .多变的。模板。参数。CPP:43:44:注意:\u2018args\u2019
2.15 .多变的。模板。参数。CPP:45:16:错误:扩展模式((),值)不包含参数包
}(),值).};
^
2.15 .多变的。模板。参数。CPP:在\ u 2018自动打印f3(T,Ts.)【其中T=intTs={int,const char*,double}]\u2019:
2.15 .多变的。模板。参数。CPP:55:35:此处必需
2.15 .多变的。模板。参数。CPP:43:5:错误:没有匹配的函数用于调用\ u 2018 STD:initializer _ list int:initializer _ list(大括号括起来的初始值设定项列表)\u2019
(void)STD:initializer _ list T {([args]{
^
在/usr/include/c/5/bits/range _ access。小时36分0秒中包含的文件中,
来自/usr/include/c /5/string:51,
来自/usr/include/c/5/bits/locale _ class。h:40,
来自/usr/include/c/5/bits/IOs _ base。h:41,
来自/usr/include/c /5/ios:42,
来自/usr/include/c /5/ostream:38,
来自/usr/include/c /5/iostream:39,
来自2.15 .多变的。模板。参数。CPP:10:
/usr/include/c/5/initializer _ list:66:17注意:candidate:const expr STD:initializer _ list _ E:initializer _ list()[with _ E=int]
const expr initializer _ list()no except
^
/usr/include/c/5/initializer _ list:66:17注意:候选项需要0个参数,但提供了一个
/usr/include/c/5/initializer _ list:62:17注:候选:const expr STD:initializer _ list _ E:initializer _ list(STD:initializer _ list _ E:const _ iterator,STD:initializer _ list _ E:size _ type)[with _ E=int;STD:initializer _ list _ E:const _ iterator=const int *;STD:initializer _ list _ E:size _ type=long unsigned int]
const expr initializer _ list(const _ iterator _ _ a,size_type __l)
^
/usr/include/c/5/initializer _ list:62:17注意:候选项需要2个参数,但只提供了一个
/usr/include/c/5/initializer _ list:47:11注意:候选项:const expr STD:initializer _ list int:initializer _ list(const STD:initializer _ list int)
类初始值设定项_列表
^
/usr/include/c/5/initializer _ list:47:11注意:参数一的转换将是错误的:
/usr/include/c/5/initializer _ list:47:11注意:候选项:const expr STD:initializer _ list int:initializer _ list(STD:initializer _ list int)
/usr/include/c/5/initializer _ list:47:11注意:参数一的转换将是错误的:
石燕楼:2/(师傅*) $。/2.15 .多变的。模板。参数。CPP[14:56:06]
石燕楼:2/(master *)$ g-STD=c 17 2.15。多变的。模板。参数。CPP-o可变温度
2.15 .多变的。模板。参数。CPP:在函数\ u 2018无效打印f2(T0,T.)\u2019:
2.15 .多变的。模板。参数。CPP:36:8:错误:应为\ u 2018(\ u 2019之前\ u 2018 const expr \ u 2019
if constexpr (sizeof.(t) 0)打印f2(t.);
^
2.15 .多变的。模板。参数。CPP:在函数中\ u 2018自动打印f3(T,Ts.)\u2019:
2.15 .多变的。模板。参数。CPP:43:40:错误:参数包没有用\u2018扩展.\u2019:
(void)STD:initializer _ list T {([args]{
^
2.15 .多变的。模板。参数。CPP:43:40:注意:\u2018args\u2019
2.15 .多变的。模板。参数。CPP:43:44:错误:参数包没有用\u2018扩展.\u2019:
(void)STD:initializer _ list T {([args]{
^
2.15 .多变的。模板。参数。CPP:43:44:注意:\u2018args\u2019
2.15 .多变的。模板。参数。CPP:45:16:错误:扩展模式((),值)不包含参数包
}(),值).};
^
2.15 .多变的。模板。参数。CPP:在\ u 2018自动打印f3(T,Ts.)【其中T=intTs={int,const char*,double}]\u2019:
2.15 .多变的。模板。参数。CPP:55:35:此处必需
2.15 .多变的。模板。参数。CPP:43:5:错误:没有匹配的函数用于调用\ u 2018 STD:initializer _ list int:initializer _ list(大括号括起来的初始值设定项列表)\u2019
(void)STD:initializer _ list T {([args]{
^
在/usr/include/c/5/bits/range _ access。小时36分0秒中包含的文件中,
来自/usr/include/c /5/string:51,
来自/usr/include/c/5/bits/locale _ class。h:40,
来自/usr/include/c/5/bits/IOs _ base。h:41,
来自/usr/include/c /5/ios:42,
来自/usr/include/c /5/ostream:38,
来自/usr/include/c /5/iostream:39,
来自2.15 .多变的。模板。参数。CPP:10:
/usr/include/c/5/initializer _ list:66:17注意:candidate:const expr STD:initializer _ list _ E:initializer _ list()[with _ E=int]
const expr initializer _ list()no except
^
/usr/include/c/5/initializer _ list:66:17注意:候选项需要0个参数,但提供了一个
/usr/include/c/5/initializer _ list:62:17注:候选:const expr STD:initializer _ list _ E:initializer _ list(STD:initializer _ list _ E:const _ iterator,STD:initializer _ list _ E:size _ type)[with _ E=int;STD:initializer _ list _ E:const _ iterator=const int *;STD:initializer _ list _ E:size _ type=long unsigned int]
const expr initializer _ list(const _ iterator _ _ a,size_type __l)
^
/usr/include/c/5/initializer _ list:62:17注意:候选项需要2个参数,但只提供了一个
/usr/include/c/5/initializer _ list:47:11注意:候选项:const expr STD:initializer _ list int:initializer _ list(const STD:initializer _ list int)
类初始值设定项_列表
^
/usr/include/c/5/initializer _ list:47:11注意:参数一的转换将是错误的:
/usr/include/c/5/initializer _ list:47:11注意:候选项:const expr STD:initializer _ list int:initializer _ list(STD:initializer _ list int)
/usr/include/c/5/initializer _ list:47:11注意:参数一的转换将是错误的:
石燕楼:2/(master *)$ g-STD=c 17 2.16折。表情。CPP-o信息exp[14:56:27]
2.16.fold.expression.cpp: In函数\ u 2018自动求和(T.)\u2019:
2.16倍. expression.cpp:13:17:错误:应为\u2018之前的主表达式.\u2019令牌
返回(t.);
^
2.16倍. expression.cpp:13:17:错误:应为\u2018)\u2019在\u2018之前.\u2019令牌
2.16倍. expression.cpp:13:20:错误:参数包没有用\u2018扩展.\u2019:
返回(t.);
^
2.16倍. expression.cpp:13:20注:\u2018t\u2019
2.16 .折叠。表情。CPP:In function \ u 2018 int main()\ u 2019:
2.16倍. expression.cpp:16:15:错误:没有与操作员匹配的操作数(操作数类型为\ u 2018 STD:ostream { aka STD:basic _ ostream char } \ u 2019和无效)
std:cout sum(1,2,3,4,5,6,7,8,9,10)STD:endl;
^
在/usr/include/c /5/iostream:39:0中包含文件中,
来自2.16倍表达式. cpp:10:
/usr/include/c /5/ostream:108:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type(*)(STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type))[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(_ _ ostream _ type(* _ _ pf)(_ _ ostream _ type))
^
/usr/include/c /5/ostream:108:7:注意:参数一从无效到\ u 2018 STD:basic _ ostream char:_ _ ostream _ type(*)(STD:basic _ ostream char:_ _ ostream _ type){ aka STD:basic _ ostream char(*)(STD:basic _ ostream char)} \ u 2019
/usr/include/c /5/ostream:117:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(STD:basic _ ostream _ CharT,_ Traits:_ _ IOs _ type(*)(STD:basic _ ostream _ CharT,_ Traits:_ _ IOs _ type))[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char STD:basic _ ostream _ CharT,_ Traits:_ _ IOs _ type=STD:basic _ IOs char]
运算符(__ios_type (*__pf)(__ios_type))
^
/usr/include/c /5/ostream:117:7:注意:参数一从无效到\ u 2018 STD:basic _ ostream char:_ _ IOs _ type(*)(STD:basic _ ostream char:_ _ IOs _ type){ aka STD:basic _ IOs char(*)(STD:basic _ IOs char)} \ u 2019
/usr/include/c /5/ostream:127:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(STD:IOs _ base(*)(STD:IOs _ base))[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(ios_base (*__pf) (ios_base))
^
/usr/include/c /5/ostream:127:7:注意:参数一没有从无效到\ u 2018 STD:IOs _ base(*)(STD:IOs _ base)\ u 2019的已知转换
/usr/include/c /5/ostream:166:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(long int)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(long __n)
^
/usr/include/c /5/ostream:166:7:注意:参数一从无效到长整型没有已知的转换
/usr/include/c /5/ostream:170:7:注意:candidate:STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(long unsigned int)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(无符号long __n)
^
/usr/include/c /5/ostream:170:7:注意:参数一从无效到长整型无符号整数没有已知的转换
/usr/include/c /5/ostream:174:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(bool)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(布尔__n)
^
/usr/include/c /5/ostream:174:7:注意:参数一没有从无效到bool的已知转换
在/usr/include/c /5/ostream:638:0中包含文件中,
来自/usr/include/c /5/iostream:39,
来自2.16倍表达式. cpp:10:
/usr/include/c/5/bits/ostream。TCC:91:5:注意:candidate:STD:basic _ ostream _ CharT,_ Traits STD:basic _ ostream _ CharT,_ Traits:operator(short int)[with _ CharT=char;_Traits=std:char_traits char ]
basic_ostream _CharT,_Traits:
^
/usr/include/c/5/bits/ostream。TCC:91:5:注意:参数一从无效到短整型没有已知的转换
在/usr/include/c /5/iostream:39:0中包含文件中,
来自2.16倍表达式. cpp:10:
/usr/include/c /5/ostream:181:7:注意:candidate:STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(short unsigned int)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(无符号短整型__n)
^
/usr/include/c /5/ostream:181:7:注意:参数一从无效到短整型无符号整型没有已知的转换
在/usr/include/c /5/ostream:638:0中包含文件中,
来自/usr/include/c /5/iostream:39,
来自2.16倍表达式. cpp:10:
/usr/include/c/5/bits/ostream。变矩器离合器:105:5:注意:candidate:STD:basic _ ostream _ CharT,_ Traits STD:basic _ ostream _ CharT,_ Traits:operator(int)[with _ CharT=char;_Traits=std:char_traits char ]
basic_ostream _CharT,_Traits:
^
/usr/include/c/5/bits/ostream。变矩器离合器:105:5:注意:参数一从无效到\u2018int\u2019没有已知的转换
在/usr/include/c /5/iostream:39:0中包含文件中,
来自2.16倍表达式. cpp:10:
/usr/include/c /5/ostream:192:7:注意:candidate:STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(unsigned int)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(无符号整数n)
^
/usr/include/c /5/ostream:192:7:注意:参数一从无效到无符号整数没有已知的转换
/usr/include/c /5/ostream:201:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(long long int)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(龙龙__n)
^
/usr/include/c /5/ostream:201:7:注意:参数一从无效到\u2018long long int\u2019没有已知的转换
/usr/include/c /5/ostream:205:7:注意:candidate:STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:运算符(long long unsigned int)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(无符号long long __n)
^
/usr/include/c /5/ostream:205:7:注意:参数一从无效到\ u 2018 long long无符号整数\ u 2019的转换未知
/usr/include/c /5/ostream:220:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(double)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(双f)
^
/usr/include/c /5/ostream:220:7:注意:参数一从无效到双份没有已知的转换
/usr/include/c /5/ostream:224:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(float)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(浮点__f)
^
/usr/include/c /5/ostream:224:7:注意:参数一从无效到浮动没有已知的转换
/usr/include/c /5/ostream:232:7:注意:candidate:STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(long double)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(长双__f)
^
/usr/include/c /5/ostream:232:7:注意:参数一从无效到长双人床没有已知的转换
/usr/include/c /5/ostream:245:7:注意:候选:std:basic_ostream _CharT,_ Traits:_ _ ostream _ type STD:basic _ ostream _ CharT,_ Traits:operator(const void *)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ ostream _ type=STD:basic _ ostream char]
运算符(常量void* __p)
^
/usr/include/c /5/ostream:245:7:注意:参数一从无效到常数void*\u2019没有已知的转换
在/usr/include/c /5/ostream:638:0中包含文件中,
来自/usr/include/c /5/iostream:39,
来自2.16倍表达式. cpp:10:
/usr/include/c/5/bits/ostream。TCC:119:5:注意:candidate:STD:basic _ ostream _ CharT,_ Traits STD:basic _ ostream _ CharT,_ Traits:operator(STD:basic _ ostream _ CharT,_ Traits:_ _ streambuf _ type *)[with _ CharT=char;_ Traits=STD:char _ Traits char STD:basic _ ostream _ CharT,_ Traits:_ _ streambuf _ type=STD:basic _ streambuf char]
basic_ostream _CharT,_Traits:
^
/usr/include/c/5/bits/ostream。TCC:119:5:注意:参数一从无效到\ u 2018 STD:basic _ ostream char:_ _ streambuf _ type * { aka STD:basic _ streambuf char * } \ u 2019没有已知的转换
在包含于/的文件中
usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:628:5: note: candidate: template class _CharT, class _Traits, class _Tp std::basic_ostream _CharT, _Traits std::operator (std::basic_ostream _CharT, _Traits , const _Tp )
operator (basic_ostream _CharT, _Traits __os, const _Tp __x)
^
/usr/include/c++/5/ostream:628:5: note: template argument deduction/substitution failed:
/usr/include/c++/5/ostream: In substitution of \u2018template class _CharT, class _Traits, class _Tp std::basic_ostream _CharT, _Traits std::operator (std::basic_ostream _CharT, _Traits , const _Tp ) [with _CharT = char; _Traits = std::char_traits char _Tp = void]\u2019:
2.16.fold.expression.cpp:16:51: required from here
/usr/include/c++/5/ostream:628:5: error: forming reference to void
/usr/include/c++/5/ostream:574:5: note: candidate: template class _Traits std::basic_ostream char, _Traits std::operator (std::basic_ostream char, _Traits , const unsigned char*)
operator (basic_ostream char, _Traits __out, const unsigned char* __s)
^
/usr/include/c++/5/ostream:574:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018const unsigned char*\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:569:5: note: candidate: template class _Traits std::basic_ostream char, _Traits std::operator (std::basic_ostream char, _Traits , const signed char*)
operator (basic_ostream char, _Traits __out, const signed char* __s)
^
/usr/include/c++/5/ostream:569:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018const signed char*\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:556:5: note: candidate: template class _Traits std::basic_ostream char, _Traits std::operator (std::basic_ostream char, _Traits , const char*)
operator (basic_ostream char, _Traits __out, const char* __s)
^
/usr/include/c++/5/ostream:556:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018const char*\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/ostream:638:0,
from /usr/include/c++/5/iostream:39,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/bits/ostream.tcc:321:5: note: candidate: template class _CharT, class _Traits std::basic_ostream _CharT, _Traits std::operator (std::basic_ostream _CharT, _Traits , const char*)
operator (basic_ostream _CharT, _Traits __out, const char* __s)
^
/usr/include/c++/5/bits/ostream.tcc:321:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018const char*\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:539:5: note: candidate: template class _CharT, class _Traits std::basic_ostream _CharT, _Traits std::operator (std::basic_ostream _CharT, _Traits , const _CharT*)
operator (basic_ostream _CharT, _Traits __out, const _CharT* __s)
^
/usr/include/c++/5/ostream:539:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:51: note: mismatched types \u2018const _CharT*\u2019 and \u2018void\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:519:5: note: candidate: template class _Traits std::basic_ostream char, _Traits std::operator (std::basic_ostream char, _Traits , unsigned char)
operator (basic_ostream char, _Traits __out, unsigned char __c)
^
/usr/include/c++/5/ostream:519:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018unsigned char\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:514:5: note: candidate: template class _Traits std::basic_ostream char, _Traits std::operator (std::basic_ostream char, _Traits , signed char)
operator (basic_ostream char, _Traits __out, signed char __c)
^
/usr/include/c++/5/ostream:514:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018signed char\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:508:5: note: candidate: template class _Traits std::basic_ostream char, _Traits std::operator (std::basic_ostream char, _Traits , char)
operator (basic_ostream char, _Traits __out, char __c)
^
/usr/include/c++/5/ostream:508:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018char\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:502:5: note: candidate: template class _CharT, class _Traits std::basic_ostream _CharT, _Traits std::operator (std::basic_ostream _CharT, _Traits , char)
operator (basic_ostream _CharT, _Traits __out, char __c)
^
/usr/include/c++/5/ostream:502:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018char\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/iostream:39:0,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/ostream:497:5: note: candidate: template class _CharT, class _Traits std::basic_ostream _CharT, _Traits std::operator (std::basic_ostream _CharT, _Traits , _CharT)
operator (basic_ostream _CharT, _Traits __out, _CharT __c)
^
/usr/include/c++/5/ostream:497:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:51: note: deduced conflicting types for parameter \u2018_CharT\u2019 (\u2018char\u2019 and \u2018void\u2019)
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/bits/ios_base.h:46:0,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iostream:39,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/system_error:209:5: note: candidate: template class _CharT, class _Traits std::basic_ostream _CharT, _Traits std::operator (std::basic_ostream _CharT, _Traits , const std::error_code )
operator (basic_ostream _CharT, _Traits __os, const error_code __e)
^
/usr/include/c++/5/system_error:209:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:21: note: cannot convert \u2018sum {int, int, int, int, int, int, int, int, int, int} (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\u2019 (type \u2018void\u2019) to type \u2018const std::error_code \u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
In file included from /usr/include/c++/5/string:52:0,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iostream:39,
from 2.16.fold.expression.cpp:10:
/usr/include/c++/5/bits/basic_string.h:5172:5: note: candidate: template class _CharT, class _Traits, class _Alloc std::basic_ostream _CharT, _Traits std::operator (std::basic_ostream _CharT, _Traits , const std::__cxx11::basic_string _CharT, _Traits, _Alloc )
operator (basic_ostream _CharT, _Traits __os,
^
/usr/include/c++/5/bits/basic_string.h:5172:5: note: template argument deduction/substitution failed:
2.16.fold.expression.cpp:16:51: note: mismatched types \u2018const std::__cxx11::basic_string _CharT, _Traits, _Alloc \u2019 and \u2018void\u2019
std::cout sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) std::endl;
^
shiyanlou:2/ (master*) $ g++ -std=c++17 2.18.non.type.template.auto.cpp -o notemp
2.18.non.type.template.auto.cpp:12:16: error: \u2018auto\u2019 parameter not permitted in this context
template auto value void foo() {
^
2.18.non.type.template.auto.cpp: In function \u2018int main()\u2019:
2.18.non.type.template.auto.cpp:18:13: error: no matching function for call to \u2018foo()\u2019
foo 10 // value is deduced as type int
^
2.18.non.type.template.auto.cpp:12:28: note: candidate: template typeprefixerror value void foo()
template auto value void foo() {
^
2.18.non.type.template.auto.cpp:12:28: note: template argument deduction/substitution failed:
2.18.non.type.template.auto.cpp:18:13: note: invalid template non-type parameter
foo 10 // value is deduced as type int
^
shiyanlou:2/ (master*) $ [15:03:09]
© ©
郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。