lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master db53742 3/8: Define only the relational opera


From: Greg Chicares
Subject: [lmi-commits] [lmi] master db53742 3/8: Define only the relational operators that have proved useful for dates
Date: Sun, 25 Feb 2018 17:15:13 -0500 (EST)

branch: master
commit db5374278eca18bef9c7610b658f078943f9d188
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Define only the relational operators that have proved useful for dates
---
 calendar_date.cpp | 10 ++++++++++
 calendar_date.hpp |  5 +++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/calendar_date.cpp b/calendar_date.cpp
index 394c24f..d2f9f3d 100644
--- a/calendar_date.cpp
+++ b/calendar_date.cpp
@@ -272,11 +272,21 @@ bool calendar_date::operator==(calendar_date const& z) 
const
     return jdn_ == z.jdn_;
 }
 
+bool calendar_date::operator!=(calendar_date const& z) const
+{
+    return jdn_ != z.jdn_;
+}
+
 bool calendar_date::operator<(calendar_date const& z) const
 {
     return jdn_ < z.jdn_;
 }
 
+bool calendar_date::operator<=(calendar_date const& z) const
+{
+    return jdn_ <= z.jdn_;
+}
+
 int calendar_date::year() const
 {
     return cached_year_;
diff --git a/calendar_date.hpp b/calendar_date.hpp
index c659c3e..6cd4459 100644
--- a/calendar_date.hpp
+++ b/calendar_date.hpp
@@ -125,7 +125,6 @@ jdn_t LMI_SO YmdToJdn(ymd_t);
 
 class LMI_SO calendar_date
     :boost::additive<calendar_date,int>
-    ,boost::totally_ordered<calendar_date>
 {
   public:
     enum
@@ -152,7 +151,9 @@ class LMI_SO calendar_date
     int julian_day_number() const;
 
     bool operator==(calendar_date const&) const;
-    bool operator<(calendar_date const&) const;
+    bool operator!=(calendar_date const&) const;
+    bool operator< (calendar_date const&) const;
+    bool operator<=(calendar_date const&) const;
 
     int year() const;
     int month() const;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]