lmi-commits
[Top][All Lists]
Advanced

[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&);
 



reply via email to

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