Allow using wxDateTime::operator==() and !=() with invalid objects

Unlike the other operators, we comparing for equality has a well-defined
semantics even for invalid objects, so there doesn't seem any reason to not
allow it.
This commit is contained in:
Kevin B. McCarty 2015-05-09 19:28:04 +02:00 committed by Vadim Zeitlin
parent fda904ea77
commit 56aa94c61e

View File

@ -836,12 +836,15 @@ public:
inline bool operator==(const wxDateTime& dt) const
{
return GetValue() == dt.GetValue();
// Intentionally do not call GetValue() here, in order that
// invalid wxDateTimes may be compared for equality
return m_time == dt.m_time;
}
inline bool operator!=(const wxDateTime& dt) const
{
return GetValue() != dt.GetValue();
// As above, don't use GetValue() here.
return m_time != dt.m_time;
}
// arithmetics with dates (see also below for more operators)