But I want to know how can I sort 2D array in STL sort().
For example,
Code: Select all
// before sort
string data[3][2] = { {"cab","hello"}, {"cba","world"}, {"abc","haha"}};
// After sort
string data[3][2] = { {"abc","haha"}, {"cab","hello"}, {"cba","world"}};
How can I wrote comp() function for my sort() method??
Code: Select all
// I'll use like this
sort( &data[0], data[3], comp );