【发布时间】:2016-10-14 23:52:17
【问题描述】:
我有这样的数组:
long my_array_left[n][2];
我为它写了比较器函数,它接受两个元素的数组并按数组的第一个元素排序:
struct sort_left {
bool operator()(const long &left[2], const long &right[2]) {
return left[0] < right[0];
}
}
然后我使用库函数std::sort对my_array_left[n][2]进行排序
sort(begin(my_array_left), end(my_array_left), sort_left());
但我有一个错误:
parameter type mismatch: Incompatible pointer types 'long **' and 'long[2]*'.
我该如何克服它?
【问题讨论】:
-
你的编译器真的说
long[2]*? -
@aschepler 没错!