extra parameter in comparator function for sort

Solutions on MaxInterview for extra parameter in comparator function for sort by the best coders in the world

showing results for - "extra parameter in comparator function for sort"
Sofie
25 Sep 2020
1class TopicSorter{
2    Query query_;
3public:
4    TopicSorter(Query query){ query_ = query; }
5    bool operator()(Topic t1, Topic t2) const {
6    return compareTopics( t1 , t2 , query_);
7    }
8};