Fix error 'call of overloaded ... is ambiguous'

With Qt 5.9, I got an error when calling compare(BlackMisc::Network::CEntityFlags::Entity,
BlackMisc::Network::CEntityFlags::Entity). The underlying integral type
of an enum is implementation defined and gcc seem to choose an unsigned
int in this case. This made the call ambiguous, since there was no unsigned
int overload yet of compare.
This commit is contained in:
Roland Winklmeier
2017-02-23 11:10:38 +01:00
committed by Mathew Sutcliffe
parent 2ab7071423
commit 11d641bb97
2 changed files with 9 additions and 0 deletions

View File

@@ -26,6 +26,12 @@ namespace BlackMisc
return a < b ? -10 : 10;
}
int compare(uint a, uint b)
{
if (a == b) return 0;
return a < b ? -10 : 10;
}
int compare(qint64 a, qint64 b)
{
if (a == b) return 0;