From 7809adc6cee15dfabce01d693c110877551a6127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dziepak?= Date: Tue, 24 May 2016 01:14:28 +0100 Subject: [PATCH] keys: add compound_wrapper::tri_compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Dziepak --- keys.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/keys.hh b/keys.hh index b874413a53..26edd310e8 100644 --- a/keys.hh +++ b/keys.hh @@ -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)) {}