@Codewzs
2019-04-14T08:30:20.000000Z
字数 325
阅读 614
C++模板
template<class T>void r(T &a)
{
T s=0,w=1;a=0;char ch=getc(stdin);
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getc(stdin);}
while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getc(stdin);}
a=w*s;
}
template<class T,class... Y>void r(T& t,Y&... a){r(t);r(a...);}
注意:使用此输入优化,请在头文件前加上以下代码:
#pragma GCC diagnostic error "-std=c++11"
使用方法:
int a=1,b=2;
r(a,b);