Using friend function comparison and arithmetic operators, for parameter symmetry.

This commit is contained in:
Mat Sutcliffe
2019-02-27 22:27:34 +00:00
parent 1089adf18d
commit 798a0b8f06
5 changed files with 27 additions and 67 deletions

View File

@@ -272,10 +272,17 @@ namespace BlackMisc
}
//! Equal operator ==
bool operator == (const CMeasurementUnit &other) const;
friend bool operator == (const CMeasurementUnit &a, const CMeasurementUnit &b)
{
if (&a == &b) return true;
return a.m_data->m_name == b.m_data->m_name;
}
//! Unequal operator !=
bool operator != (const CMeasurementUnit &other) const;
friend bool operator != (const CMeasurementUnit &a, const CMeasurementUnit &b)
{
return !(a == b);
}
//! \copydoc CValueObject::qHash
friend uint qHash(const CMeasurementUnit &unit)