单选题
已知主函数中通过如下语句序列实现对函数模板swap的调用______。
int a[10], b[10];
swap(a, b, 10);
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);
【正确答案】
A
【答案解析】
[解析] 该题考查的内容是声明一个函数模板的格式是:
template<<模板形参表声明>><函数声明>
选项A是正确的。
提交答案
关闭