选择题
已知主函数中通过如下语句序列实现对函数模板swap的调用:
int a[10],b[io];
swap(a,b,10);
下列对函数模板swap的声明中,会导致上述语句序列发生编译错误的是______。
A、
template <typename T> void swap(T a[],T b[],int size);
B、
template<typename T> void swap(int size,T a[],T b[]);
C、
template<typename T1,typename T2> void swap(T1 a[],T2 b[],int size);
D、
template<class T1,class T2> void swap(T1 a[],T2 b[],int size);
【正确答案】
B
【答案解析】
参数顺序有错。
提交答案
关闭