diff -r 6d95c1a41e6e -r 63125c36de73 src/basics.h --- a/src/basics.h Tue Jun 14 17:55:50 2022 +0300 +++ b/src/basics.h Tue Jun 14 19:50:31 2022 +0300 @@ -37,6 +37,7 @@ #include #include "geometry.h" #include "functional.h" +#include "typeconversions.h" template using opt = std::optional; @@ -51,46 +52,6 @@ return N; } -//! \brief casts @c x to a suitable unsigned integer -template -constexpr auto unsigned_cast(T x) - -> std::enable_if_t, std::make_unsigned_t> -{ - return static_cast>(x); -} - -//! \brief casts @c x to a suitable signed integer -template -constexpr auto signed_cast(T x) - -> std::enable_if_t, std::make_signed_t> -{ - return static_cast>(x); -} - -//! \brief casts floating point values to float -template -constexpr auto float_cast(T x) - -> std::enable_if_t, float> -{ - return static_cast(x); -} - -//! \brief casts floating point values to double -template -constexpr auto double_cast(T x) - -> std::enable_if_t, double> -{ - return static_cast(x); -} - -//! \brief casts floating point values to qreal -template -constexpr auto qreal_cast(T x) - -> std::enable_if_t, qreal> -{ - return static_cast(x); -} - template constexpr QPointF toQPointF(const glm::vec& vec) {