keys: add compound_wrapper::tri_compare

Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
This commit is contained in:
Paweł Dziepak
2016-05-24 01:14:28 +01:00
parent c24f08a683
commit 7809adc6ce

14
keys.hh
View File

@@ -220,6 +220,20 @@ public:
return result;
}
struct tri_compare {
typename TopLevel::compound _t;
tri_compare(const schema& s) : _t(get_compound_type(s)) {}
int operator()(const TopLevel& k1, const TopLevel& k2) const {
return _t->compare(k1.representation(), k2.representation());
}
int operator()(const TopLevelView& k1, const TopLevel& k2) const {
return _t->compare(k1.representation(), k2.representation());
}
int operator()(const TopLevel& k1, const TopLevelView& k2) const {
return _t->compare(k1.representation(), k2.representation());
}
};
struct less_compare {
typename TopLevel::compound _t;
less_compare(const schema& s) : _t(get_compound_type(s)) {}