aboutsummaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-20 19:05:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-20 19:05:42 +0200
commit81da3ee11305296c0ec8300b35ef70d791cb3c77 (patch)
tree4367452268b9b569b12dd65c446a742f5c6d89c3 /odb
parentb991f4fab1d15ac3b9ddd194f0cd7d7d77fc9924 (diff)
Add missing comparison operators for odb::nullable
Diffstat (limited to 'odb')
-rw-r--r--odb/nullable.hxx33
1 files changed, 33 insertions, 0 deletions
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 <typename T>
+ inline bool
+ operator== (const nullable<T>& x, const nullable<T>& y)
+ {
+ return x.null () == y.null () && (x.null () || *x == *y);
+ }
+
+ template <typename T>
+ inline bool
+ operator!= (const nullable<T>& x, const nullable<T>& y) {return !(x == y);}
+
+ template <typename T>
+ inline bool
+ operator< (const nullable<T>& x, const nullable<T>& y)
+ {
+ return x.null () > y.null () || (!x.null () && !y.null () && *x < *y);
+ }
+
+ template <typename T>
+ inline bool
+ operator> (const nullable<T>& x, const nullable<T>& y)
+ {
+ return x.null () < y.null () || (!x.null () && !y.null () && *x > *y);
+ }
+
+ template <typename T>
+ inline bool
+ operator<= (const nullable<T>& x, const nullable<T>& y) {return !(x > y);}
+
+ template <typename T>
+ inline bool
+ operator>= (const nullable<T>& x, const nullable<T>& y) {return !(x < y);}
+
+ template <typename T>
inline nullable<T>::
nullable ()
: null_ (true)