已知主函数中通过如下语句序列实现对函数模板swap的调用: int a[10], b[10]; swap(a, b, 10); 下列对函数模板swap的声明中,会导致上述语句序列发生编译错误的是( )。 A) template<ty

admin2017-10-17  25

问题 已知主函数中通过如下语句序列实现对函数模板swap的调用:
   int a[10], b[10];
   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);

选项 A、 
B、 
C、 
D、 

答案B

解析
转载请注明原文地址:https://jikaoti.com/ti/Jnt0FFFM
0

最新回复(0)