私は、このような配列を持っている:配列の配列をstd :: sortで並べ替えるには?
struct sort_left {
bool operator()(const long &left[2], const long &right[2]) {
return left[0] < right[0];
}
}
は、その後、私は、ソートのためのライブラリ機能std::sort
を使用します。私は、ソート配列の最初の要素によって二つの要素の配列を受け取り、それのためのコンパレータ機能を、書いた
long my_array_left[n][2];
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]*'
。
どのように私はそれを克服できますか?
related/dupe:http://stackoverflow.com/questions/20931669/sort-a-2d-array-in-c-using-built-in-function-other-other-method – NathanOliver
あなたのコンパイラは本当に '長い[2] * '? – aschepler
@ascheplerまさに! – kotokbek