fork download
  1. #include <algorithm>
  2. #include <string>
  3.  
  4. template <typename T>
  5. class ReverseComparator{
  6. public:
  7. bool operator()(T l, T r){return !(l < r);}
  8. };
  9.  
  10. int main() {
  11. std::string str = "HELLO";
  12. ReverseComparator<char> comparator;
  13. std::sort(str.begin(), str.end(), comparator);
  14. }
Success #stdin #stdout 0s 3060KB
stdin
Standard input is empty
stdout
Standard output is empty