From 81da3ee11305296c0ec8300b35ef70d791cb3c77 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 20 Jul 2016 19:05:42 +0200 Subject: Add missing comparison operators for odb::nullable --- odb/nullable.hxx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/odb/nullable.hxx b/odb/nullable.hxx index ccfe01b..80a76c1 100644 --- a/odb/nullable.hxx +++ b/odb/nullable.hxx @@ -60,6 +60,39 @@ namespace odb } template + inline bool + operator== (const nullable& x, const nullable& y) + { + return x.null () == y.null () && (x.null () || *x == *y); + } + + template + inline bool + operator!= (const nullable& x, const nullable& y) {return !(x == y);} + + template + inline bool + operator< (const nullable& x, const nullable& y) + { + return x.null () > y.null () || (!x.null () && !y.null () && *x < *y); + } + + template + inline bool + operator> (const nullable& x, const nullable& y) + { + return x.null () < y.null () || (!x.null () && !y.null () && *x > *y); + } + + template + inline bool + operator<= (const nullable& x, const nullable& y) {return !(x > y);} + + template + inline bool + operator>= (const nullable& x, const nullable& y) {return !(x < y);} + + template inline nullable:: nullable () : null_ (true) -- cgit v1.1