diff -r 0f80a2e5e42b -r 1a9eac27698d src/basics.h --- a/src/basics.h Fri Feb 07 02:02:16 2020 +0200 +++ b/src/basics.h Fri Feb 07 23:59:06 2020 +0200 @@ -85,5 +85,25 @@ 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); +} + Q_DECLARE_METATYPE(glm::vec3) Q_DECLARE_METATYPE(glm::mat4)