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:
committed by
Vadim Zeitlin
parent
fda904ea77
commit
56aa94c61e
@@ -836,12 +836,15 @@ public:
|
|||||||
|
|
||||||
inline bool operator==(const wxDateTime& dt) const
|
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
|
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)
|
// arithmetics with dates (see also below for more operators)
|
||||||
|
Reference in New Issue
Block a user