maths: use double negation for equality bool conversion
This commit is contained in:
parent
5dda5d130a
commit
af5da5b846
@ -56,7 +56,9 @@ namespace util {
|
|||||||
>
|
>
|
||||||
equal (const Ta &a, const Tb &b)
|
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)
|
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
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user