maths: use double negation for equality bool conversion

This commit is contained in:
Danny Robson 2018-03-16 11:10:08 +11:00
parent 5dda5d130a
commit af5da5b846

View File

@ -56,7 +56,9 @@ namespace util {
>
equal (const Ta &a, const Tb &b)
{
return a == b;
// use double not to force conversion for types with explicit bool
// operators on the result of equality
return !!(a == b);
}
//-------------------------------------------------------------------------
@ -69,7 +71,9 @@ namespace util {
>
equal (const Ta &a, const Tb &b)
{
return a == b;
// use double not to force conversion for types with explicit bool
// operators on the result of equality
return !!(a == b);
}
#pragma GCC diagnostic pop