#include#include#includeboolcustom_compare(int a, int b){
return a > b; // 降序排列
}
intmain(){
std::vector<int> vec = {5, 4, 3, 2, 1};
if (std::is_sorted(vec.begin(), vec.end(), custom_compare)) {
std::cout << "The vector is sorted in descending order."<< std class="hljs-keyword">else {
std::cout << "The vector is not sorted in descending order."<< std class="hljs-keyword">return 0;
}