language: C++11 (gcc-4.7.2)
date: 141 days 20 hours ago
link:
visibility: private
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <algorithm>
#include <string>
 
template <typename T>
class ReverseComparator{
    public:
     bool operator()(T l, T r){return !(l < r);}
};
 
int main() {
    std::string str = "HELLO";
    ReverseComparator<char> comparator;
    std::sort(str.begin(), str.end(), comparator);
}