Make wxFontBase::operator==() symmetric by taking wxFontBase

Taking wxFont here resulted in a potential ambiguity when comparing
wxFont objects, at least according to clang 12 in C++20 mode.

Avoid this by just taking wxFontBase here, as now the operator is fully
symmetric, rather than exactly matching only (wxFontBase, wxFont) and
matching (wxFont, wxFont) either directly or with reversed arguments
order.
This commit is contained in:
Vadim Zeitlin
2021-04-25 18:46:33 +02:00
parent 51cb0e53b1
commit ffc3168f6f
2 changed files with 3 additions and 3 deletions

View File

@@ -395,8 +395,8 @@ public:
#endif // wxUSE_PRIVATE_FONTS #endif // wxUSE_PRIVATE_FONTS
// comparison // comparison
bool operator==(const wxFont& font) const; bool operator==(const wxFontBase& font) const;
bool operator!=(const wxFont& font) const { return !(*this == font); } bool operator!=(const wxFontBase& font) const { return !(*this == font); }
// accessors: get the font characteristics // accessors: get the font characteristics
virtual int GetPointSize() const; virtual int GetPointSize() const;

View File

@@ -425,7 +425,7 @@ bool wxFontBase::SetNativeFontInfoUserDesc(const wxString& info)
return false; return false;
} }
bool wxFontBase::operator==(const wxFont& font) const bool wxFontBase::operator==(const wxFontBase& font) const
{ {
// either it is the same font, i.e. they share the same common data or they // either it is the same font, i.e. they share the same common data or they
// have different ref datas but still describe the same font // have different ref datas but still describe the same font