📅  最后修改于: 2022-03-11 14:44:52.543000             🧑  作者: Mango
vector v = {50, -10, 20, -30};
sort(v.begin(), v.end()); // the default sort
// now v should be { -30, -10, 20, 50 }
// sort by absolute value:
sort(v.begin(), v.end(), [](int a, int b) { return abs(a)