[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;
- [lmi-commits] [lmi] master updated (0c16a43 -> 5d71aea), Greg Chicares, 2018/02/25
- [lmi-commits] [lmi] master f15d7c0 2/8: Remove unwanted postincrement operator, Greg Chicares, 2018/02/25
- [lmi-commits] [lmi] master f481f1e 1/8: Expunge commentary that has become irrelevant, Greg Chicares, 2018/02/25
- [lmi-commits] [lmi] master db53742 3/8: Define only the relational operators that have proved useful for dates,
Greg Chicares <=
- [lmi-commits] [lmi] master 1c65496 5/8: Dispense with boost/operators for one class, Greg Chicares, 2018/02/25
- [lmi-commits] [lmi] master 340ae3c 4/8: Test mixed-mode date arithmetic, Greg Chicares, 2018/02/25
- [lmi-commits] [lmi] master 2598df5 6/8: Dispense with boost/operators for one class, Greg Chicares, 2018/02/25
- [lmi-commits] [lmi] master 5d71aea 8/8: Remove obsolete references to boost, Greg Chicares, 2018/02/25
- [lmi-commits] [lmi] master 0819953 7/8: Dispense with boost/operators altogether, Greg Chicares, 2018/02/25