#ifndef THETA_COMPARATORS_HPP_
#define THETA_COMPARATORS_HPP_
namespace datasketches {
template<typename ExtractKey>
struct compare_by_key {
template<typename Entry1, typename Entry2>
bool operator()(Entry1&& a, Entry2&& b) const {
return ExtractKey()(std::forward<Entry1>(a)) < ExtractKey()(std::forward<Entry2>(b));
}
};
template<typename Key, typename Entry, typename ExtractKey>
class key_less_than {
public:
explicit key_less_than(const Key& key): key(key) {}
bool operator()(const Entry& entry) const {
return ExtractKey()(entry) < this->key;
}
private:
Key key;
};
}
#endif