写了一个template的冒泡排序,然而莫名报错,求教。
代码如下:
template<class SORT> SORT bubble_sort(SORT &array[],SORT elements){ for(int i=0;i<elements;i++) for(int j=i+1;j<elements;j++){ if(array[i]>array[j])swap(&array[i],&array[j]); } }