diff --git a/src/libs/vlayout/vlayoutpoint.h b/src/libs/vlayout/vlayoutpoint.h index 9c96cb9dc..e202aa402 100644 --- a/src/libs/vlayout/vlayoutpoint.h +++ b/src/libs/vlayout/vlayoutpoint.h @@ -71,7 +71,7 @@ template inline auto CastTo(const QVector &points, QVector &cast //--------------------------------------------------------------------------------------------------------------------- // upcast -template ::value>::type * = nullptr> +template > * = nullptr> inline auto CastTo(const QVector &points, QVector &casted) -> void { casted.clear(); @@ -84,7 +84,7 @@ inline auto CastTo(const QVector &points, QVector &casted) -> voi //--------------------------------------------------------------------------------------------------------------------- // downcast -template ::value>::type * = nullptr> +template > * = nullptr> inline auto CastTo(const QVector &points, QVector &casted) -> void { casted.clear(); diff --git a/src/libs/vmisc/fpm/fixed.hpp b/src/libs/vmisc/fpm/fixed.hpp index b73d8d2e0..42a5b597d 100644 --- a/src/libs/vmisc/fpm/fixed.hpp +++ b/src/libs/vmisc/fpm/fixed.hpp @@ -19,12 +19,12 @@ namespace fpm //! \tparam FractionBits the number of bits of the BaseType used to store the fraction template class fixed { - static_assert(std::is_integral::value, "BaseType must be an integral type"); + static_assert(std::is_integral_v, "BaseType must be an integral type"); static_assert(FractionBits > 0, "FractionBits must be greater than zero"); static_assert(FractionBits <= sizeof(BaseType) * 8 - 1, "BaseType must at least be able to contain entire " "fraction, with space for at least one integral bit"); static_assert(sizeof(IntermediateType) > sizeof(BaseType), "IntermediateType must be larger than BaseType"); - static_assert(std::is_signed::value == std::is_signed::value, + static_assert(std::is_signed_v == std::is_signed_v, "IntermediateType must have same signedness as BaseType"); // Although this value fits in the BaseType in terms of bits, if there's only one integral bit, this value @@ -44,7 +44,7 @@ public: // Converts an integral number to the fixed-point type. // Like static_cast, this truncates bits that don't fit. - template ::value>::type * = nullptr> + template > * = nullptr> constexpr inline explicit fixed(T val) noexcept : m_value(static_cast(val * FRACTION_MULT)) { @@ -52,7 +52,7 @@ public: // Converts an floating-point number to the fixed-point type. // Like static_cast, this truncates bits that don't fit. - template ::value>::type * = nullptr> + template > * = nullptr> constexpr inline explicit fixed(T val) noexcept : m_value(static_cast((val >= 0.0) ? (val * FRACTION_MULT + T{0.5}) : (val * FRACTION_MULT - T{0.5}))) { @@ -67,14 +67,14 @@ public: } // Explicit conversion to a floating-point type - template ::value>::type * = nullptr> + template > * = nullptr> constexpr inline explicit operator T() const noexcept { return static_cast(m_value) / FRACTION_MULT; } // Explicit conversion to an integral type - template ::value>::type * = nullptr> + template > * = nullptr> constexpr inline explicit operator T() const noexcept { return static_cast(m_value / FRACTION_MULT); @@ -87,8 +87,7 @@ public: //! Constructs a fixed-point number from another fixed-point number. //! \tparam NumFractionBits the number of bits used by the fraction in \a value. //! \param value the integer fixed-point number - template FractionBits)>::type * = nullptr> + template FractionBits)> * = nullptr> static constexpr inline auto from_fixed_point(T value) noexcept -> fixed { // To correctly round the last bit in the result, we need one more bit of information. @@ -98,8 +97,7 @@ public: raw_construct_tag{}); } - template ::type * = nullptr> + template * = nullptr> static constexpr inline auto from_fixed_point(T value) noexcept -> fixed { return fixed(static_cast(value * (T(1) << (FractionBits - NumFractionBits))), raw_construct_tag{}); @@ -132,7 +130,7 @@ public: return *this; } - template ::value>::type * = nullptr> + template > * = nullptr> inline auto operator+=(I y) noexcept -> fixed & { m_value += y * FRACTION_MULT; @@ -145,7 +143,7 @@ public: return *this; } - template ::value>::type * = nullptr> + template > * = nullptr> inline auto operator-=(I y) noexcept -> fixed & { m_value -= y * FRACTION_MULT; @@ -163,7 +161,7 @@ public: return *this; } - template ::value>::type * = nullptr> + template > * = nullptr> inline auto operator*=(I y) noexcept -> fixed & { m_value *= y; @@ -181,7 +179,7 @@ public: return *this; } - template ::value>::type * = nullptr> + template > * = nullptr> inline auto operator/=(I y) noexcept -> fixed & { m_value /= y; @@ -192,14 +190,14 @@ public: // Shift operators // - template ::value>::type * = nullptr> + template > * = nullptr> inline auto operator>>=(I y) noexcept -> fixed & { m_value >>= y; return *this; } - template ::value>::type * = nullptr> + template > * = nullptr> inline auto operator<<=(I y) noexcept -> fixed & { m_value <<= y; @@ -228,15 +226,13 @@ constexpr inline auto operator+(const fixed &x, const fixed &y return fixed(x) += y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator+(const fixed &x, T y) noexcept -> fixed { return fixed(x) += y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator+(T x, const fixed &y) noexcept -> fixed { return fixed(y) += x; @@ -252,15 +248,13 @@ constexpr inline auto operator-(const fixed &x, const fixed &y return fixed(x) -= y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator-(const fixed &x, T y) noexcept -> fixed { return fixed(x) -= y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator-(T x, const fixed &y) noexcept -> fixed { return fixed(x) -= y; @@ -276,15 +270,13 @@ constexpr inline auto operator*(const fixed &x, const fixed &y return fixed(x) *= y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator*(const fixed &x, T y) noexcept -> fixed { return fixed(x) *= y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator*(T x, const fixed &y) noexcept -> fixed { return fixed(y) *= x; @@ -300,15 +292,13 @@ constexpr inline auto operator/(const fixed &x, const fixed &y return fixed(x) /= y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator/(const fixed &x, T y) noexcept -> fixed { return fixed(x) /= y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator/(T x, const fixed &y) noexcept -> fixed { return fixed(x) /= y; @@ -318,15 +308,13 @@ constexpr inline auto operator/(T x, const fixed &y) noexcept -> fixed< // Shift operators // -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator>>(const fixed &x, T y) noexcept -> fixed { return fixed(x) >>= y; } -template ::value>::type * = nullptr> +template > * = nullptr> constexpr inline auto operator<<(const fixed &x, T y) noexcept -> fixed { return fixed(x) <<= y; diff --git a/src/libs/vmisc/fpm/math.hpp b/src/libs/vmisc/fpm/math.hpp index 6b7ca983f..35fe8a416 100644 --- a/src/libs/vmisc/fpm/math.hpp +++ b/src/libs/vmisc/fpm/math.hpp @@ -251,7 +251,7 @@ inline auto modf(fixed x, fixed *iptr) noexcept -> fixed::value>::type * = nullptr> + std::enable_if_t> * = nullptr> auto pow(fixed base, T exp) noexcept -> fixed { using Fixed = fixed; diff --git a/src/libs/vtest/abstracttest.cpp b/src/libs/vtest/abstracttest.cpp index 8577df1f6..7c7ee762f 100644 --- a/src/libs/vtest/abstracttest.cpp +++ b/src/libs/vtest/abstracttest.cpp @@ -698,7 +698,7 @@ void AbstractTest::ReadPieceNodeValue(const QJsonObject &itemObject, VPieceNode } //--------------------------------------------------------------------------------------------------------------------- -template ::value>::type *> +template > *> void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString &attribute, T &value, const QString &defaultValue) { @@ -737,7 +737,7 @@ void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString } //--------------------------------------------------------------------------------------------------------------------- -template ::value>::type *> +template > *> void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString &attribute, T &value, const QString &defaultValue) { @@ -776,7 +776,7 @@ void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString } //--------------------------------------------------------------------------------------------------------------------- -template ::value>::type *> +template > *> void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString &attribute, T &value, const QString &defaultValue) { diff --git a/src/libs/vtest/abstracttest.h b/src/libs/vtest/abstracttest.h index ad81dda3c..764783b20 100644 --- a/src/libs/vtest/abstracttest.h +++ b/src/libs/vtest/abstracttest.h @@ -114,13 +114,13 @@ protected: static void PrepareDocument(const QString &json, QByteArray &data); static void TestRoot(const QJsonObject &root, const QString &attribute, const QString &file); - template ::value>::type * = nullptr> + template > * = nullptr> static void ReadDoubleValue(const QJsonObject &itemObject, const QString &attribute, T &value, const QString &defaultValue = QString()); - template ::value>::type * = nullptr> + template > * = nullptr> static void ReadDoubleValue(const QJsonObject &itemObject, const QString &attribute, T &value, const QString &defaultValue = QString()); - template ::value>::type * = nullptr> + template > * = nullptr> static void ReadDoubleValue(const QJsonObject &itemObject, const QString &attribute, T &value, const QString &defaultValue = QString()); static void ReadStringValue(const QJsonObject &itemObject, const QString &attribute, QString &value,