aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-05-16 23:38:36 +0200
committer GitHub <noreply@github.com>2023-05-16 23:38:36 +0200
commit15e960f93ced8c94a6a45ebb2b44d0705ff7f8f6 (patch)
treee26df8e53b37b70f7b88a55770c776d32f71fab4
parentcedac2d020ae7e54d8fc5c21e390a306050bc220 (diff)
parentfa7e8d2af880989ba17aa89f7a9cb0905aff5e23 (diff)
Merge pull request #4 from OpenVicProject/date-ostream-fix
Fixed Date ostream << operator
-rw-r--r--src/openvic/Date.cpp4
-rw-r--r--src/openvic/Date.hpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/openvic/Date.cpp b/src/openvic/Date.cpp
index 003a455..d25e99f 100644
--- a/src/openvic/Date.cpp
+++ b/src/openvic/Date.cpp
@@ -57,7 +57,7 @@ Timespan::operator std::string() const {
return std::to_string(days);
}
-std::ostream& operator<<(std::ostream& out, Timespan timespan) {
+std::ostream& OpenVic::operator<<(std::ostream& out, Timespan const& timespan) {
return out << static_cast<std::string>(timespan);
}
@@ -128,7 +128,7 @@ Date::operator std::string() const {
return ss.str();
}
-std::ostream& operator<<(std::ostream& out, Date date) {
+std::ostream& OpenVic::operator<<(std::ostream& out, Date const& date) {
return out << (int) date.getYear() << '.' << (int) date.getMonth() << '.' << (int) date.getDay();
}
diff --git a/src/openvic/Date.hpp b/src/openvic/Date.hpp
index 15b7219..61de9ba 100644
--- a/src/openvic/Date.hpp
+++ b/src/openvic/Date.hpp
@@ -33,7 +33,7 @@ namespace OpenVic {
explicit operator double() const;
explicit operator std::string() const;
};
- std::ostream& operator<< (std::ostream& out, Timespan timespan);
+ std::ostream& operator<<(std::ostream& out, Timespan const& timespan);
// Represents an in-game date
// Note: Current implementation does not account for leap-years, or dates before Year 0
@@ -79,5 +79,5 @@ namespace OpenVic {
// Parsed from string of the form YYYY.MM.DD
static Date from_string(std::string const& date);
};
- std::ostream& operator<< (std::ostream& out, Date date);
+ std::ostream& operator<<(std::ostream& out, Date const& date);
}