fork download
  1. #include <algorithm>
  2. #include <array>
  3. #include <iostream>
  4.  
  5. int main()
  6. {
  7. std::array<int, 10> s = {5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
  8.  
  9. struct{ bool operator()(int a, int b) { return a < b; } } customLess;
  10.  
  11. std::sort(s.begin(), s.end(), customLess);
  12. for (auto a : s)
  13. std::cout << a << " ";
  14. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
0 1 2 3 4 5 6 7 8 9