diff --git a/DataStructures/FixedPointNumber.h b/DataStructures/FixedPointNumber.h index fe718c38f..a30e74ee4 100644 --- a/DataStructures/FixedPointNumber.h +++ b/DataStructures/FixedPointNumber.h @@ -40,7 +40,10 @@ namespace osrm { // implements an binary based fixed point number type -template +template class FixedPointNumber { static_assert(FractionalBitSize > 0, "FractionalBitSize must be greater than 0"); @@ -98,7 +101,7 @@ class FixedPointNumber // cast to floating point type T, return value template ::value>::type * = nullptr> - operator T() const noexcept + explicit operator T() const noexcept { // casts to external type (signed or unsigned) and then to float return static_cast(static_cast(m_fixed_point_state)) / PRECISION; @@ -106,7 +109,7 @@ class FixedPointNumber // warn about cast to integral type T, its disabled for good reason template ::value>::type * = nullptr> - operator T() const + explicit operator T() const { static_assert(std::is_integral::value, "casts to integral types have been disabled on purpose");