From fda904ea77e686fd3eb811de01759e27fa3545ed Mon Sep 17 00:00:00 2001 From: "Kevin B. McCarty" Date: Sat, 9 May 2015 19:28:04 +0200 Subject: [PATCH] Implement wxDateTime::Is{EqualTo,{Earlier,Later}Than}() in terms of operators Avoid duplicating the same code, even if it's trivial, in both places. Notice that these functions are implemented in terms of operators and not vice versa because we have no functions corresponding to operator<=() or operator>=(). --- include/wx/datetime.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/include/wx/datetime.h b/include/wx/datetime.h index e6f438187d..6375f06a1a 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -1768,23 +1768,17 @@ inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const { - wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); - - return m_time == datetime.m_time; + return *this == datetime; } inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const { - wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); - - return m_time < datetime.m_time; + return *this < datetime; } inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const { - wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); - - return m_time > datetime.m_time; + return *this > datetime; } inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1,