summaryrefslogtreecommitdiffstats
path: root/src/corelib/time/qdatetime.h
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-10-23 14:43:09 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-11-07 06:25:02 +0100
commit6206c6c189407f2d38fae921f3620a1c2a6f8d72 (patch)
tree642b13262a410c44d0c141a9f8caf3d547adce5a /src/corelib/time/qdatetime.h
parentcfac358fa3cfe7056f9d71b7cdb8e557dd711810 (diff)
Make QDate's operators hidden friends
Adjust the documentation to match and add missing \c before false in two cases. Change-Id: Ic287c4de0b131c3500ee72bf1201900dc3788756 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/time/qdatetime.h')
-rw-r--r--src/corelib/time/qdatetime.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h
index fc43a1b302..e728a84385 100644
--- a/src/corelib/time/qdatetime.h
+++ b/src/corelib/time/qdatetime.h
@@ -117,13 +117,6 @@ public:
[[nodiscard]] QDate addYears(int years, QCalendar cal) const;
qint64 daysTo(QDate d) const;
- constexpr bool operator==(QDate other) const { return jd == other.jd; }
- constexpr bool operator!=(QDate other) const { return jd != other.jd; }
- constexpr bool operator< (QDate other) const { return jd < other.jd; }
- constexpr bool operator<=(QDate other) const { return jd <= other.jd; }
- constexpr bool operator> (QDate other) const { return jd > other.jd; }
- constexpr bool operator>=(QDate other) const { return jd >= other.jd; }
-
static QDate currentDate();
#if QT_CONFIG(datestring)
static QDate fromString(QStringView string, Qt::DateFormat format = Qt::TextDate);
@@ -155,6 +148,13 @@ private:
friend class QDateTime;
friend class QDateTimePrivate;
+
+ friend constexpr bool operator==(QDate lhs, QDate rhs) { return lhs.jd == rhs.jd; }
+ friend constexpr bool operator!=(QDate lhs, QDate rhs) { return lhs.jd != rhs.jd; }
+ friend constexpr bool operator< (QDate lhs, QDate rhs) { return lhs.jd < rhs.jd; }
+ friend constexpr bool operator<=(QDate lhs, QDate rhs) { return lhs.jd <= rhs.jd; }
+ friend constexpr bool operator> (QDate lhs, QDate rhs) { return lhs.jd > rhs.jd; }
+ friend constexpr bool operator>=(QDate lhs, QDate rhs) { return lhs.jd >= rhs.jd; }
#ifndef QT_NO_DATASTREAM
friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QDate);
friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &);