[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 1c65496 5/8: Dispense with boost/operators fo
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 1c65496 5/8: Dispense with boost/operators for one class |
Date: |
Sun, 25 Feb 2018 17:15:14 -0500 (EST) |
branch: master
commit 1c6549666689af879f733ed0de89d49cc01997c5
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Dispense with boost/operators for one class
---
calendar_date.cpp | 15 +++++++++++++++
calendar_date.hpp | 7 ++++---
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/calendar_date.cpp b/calendar_date.cpp
index d2f9f3d..3e06a29 100644
--- a/calendar_date.cpp
+++ b/calendar_date.cpp
@@ -343,6 +343,21 @@ bool calendar_date::is_verified_jdn(int z)
return min_verified_jdn <= z && z <= max_verified_jdn;
}
+calendar_date operator+(int i, calendar_date z)
+{
+ return z += i;
+}
+
+calendar_date operator+(calendar_date z, int i)
+{
+ return z += i;
+}
+
+calendar_date operator-(calendar_date z, int i)
+{
+ return z -= i;
+}
+
std::ostream& operator<<(std::ostream& os, calendar_date const& date)
{
return os << date.julian_day_number();
diff --git a/calendar_date.hpp b/calendar_date.hpp
index 6cd4459..9e38279 100644
--- a/calendar_date.hpp
+++ b/calendar_date.hpp
@@ -27,8 +27,6 @@
#include "oecumenic_enumerations.hpp" // oenum_alb_or_anb
#include "so_attributes.hpp"
-#include <boost/operators.hpp>
-
#include <iosfwd>
#include <string>
#include <utility>
@@ -124,7 +122,6 @@ jdn_t LMI_SO YmdToJdn(ymd_t);
/// Implicitly-declared special member functions do the right thing.
class LMI_SO calendar_date
- :boost::additive<calendar_date,int>
{
public:
enum
@@ -177,6 +174,10 @@ class LMI_SO calendar_date
mutable int cached_day_;
};
+calendar_date LMI_SO operator+(int, calendar_date);
+calendar_date LMI_SO operator+(calendar_date, int);
+calendar_date LMI_SO operator-(calendar_date, int);
+
std::ostream& LMI_SO operator<<(std::ostream& os, calendar_date const&);
std::istream& LMI_SO operator>>(std::istream& is, calendar_date&);
- [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, 2018/02/25
- [lmi-commits] [lmi] master 1c65496 5/8: Dispense with boost/operators for one class,
Greg Chicares <=
- [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