how to sort a vector based on compare code example Example: sort a vector c++ sort(a.begin(), a.end());