Template < typename out_type,typename in_v >
out_type convert(const in_v & t){
stringstream stream;
stream<<t;//向流中传值
out_type result;//这里存储转换结果
stream>>result;//向result中写入值
return result;
};
error C2143: syntax error : missing ';' before '<'
d:\mycode\fcutlibrary\ljmpublic.h(16) : error C2501: 'Template' : missing storage-class or type specifiers
d:\mycode\fcutlibrary\ljmpublic.h(16) : error C2143: syntax error : missing ';' before '<'
d:\mycode\fcutlibrary\ljmpublic.h(16) : error C2899: typename cannot be used outside a template declaration
d:\mycode\fcutlibrary\ljmpublic.h(16) : error C2899: typename cannot be used outside a template declaration
out_type convert(const in_v & t){
stringstream stream;
stream<<t;//向流中传值
out_type result;//这里存储转换结果
stream>>result;//向result中写入值
return result;
};
error C2143: syntax error : missing ';' before '<'
d:\mycode\fcutlibrary\ljmpublic.h(16) : error C2501: 'Template' : missing storage-class or type specifiers
d:\mycode\fcutlibrary\ljmpublic.h(16) : error C2143: syntax error : missing ';' before '<'
d:\mycode\fcutlibrary\ljmpublic.h(16) : error C2899: typename cannot be used outside a template declaration
d:\mycode\fcutlibrary\ljmpublic.h(16) : error C2899: typename cannot be used outside a template declaration
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货