diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-23 14:02:10 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-23 14:02:10 +0100 |
| commit | d832896c9ab65c28526135441acf55644a442edc (patch) | |
| tree | 22674a1f7cddd60f352ed235b8961dc7d0f5319e /entity | |
| parent | c494073d59dc76186c3f567f6ccd0178a833626d (diff) | |
a
Diffstat (limited to 'entity')
| -rw-r--r-- | entity/erased-constraints.cpp | 14 | ||||
| -rw-r--r-- | entity/erased-constraints.hpp | 7 |
2 files changed, 9 insertions, 12 deletions
diff --git a/entity/erased-constraints.cpp b/entity/erased-constraints.cpp index a132c3b9..6b56b837 100644 --- a/entity/erased-constraints.cpp +++ b/entity/erased-constraints.cpp @@ -13,22 +13,12 @@ static_assert(sizeof(std::size_t) == sizeof(std::ptrdiff_t)); namespace floormat::entities::erased_constraints { -namespace { -template<typename T> struct is_magnum_vector_ final : std::false_type {}; -template<std::size_t N, typename T> struct is_magnum_vector_<Math::Vector<N, T>> : std::true_type {}; -template<typename T> struct is_magnum_vector_<Math::Vector2<T>> : std::true_type {}; -template<typename T> struct is_magnum_vector_<Math::Vector3<T>> : std::true_type {}; -template<typename T> struct is_magnum_vector_<Math::Vector4<T>> : std::true_type {}; -template<typename T> constexpr bool is_magnum_vector = is_magnum_vector_<T>::value; -} // namespace - template<typename T> std::pair<T, T> range::convert() const { - static_assert(sizeof(T)*2 <= sizeof(*this)); - using limits = std::numeric_limits<T>; + static_assert(sizeof(T) <= sizeof(min)); if (type == type_none) - return { limits::min(), limits::max() }; + return { std::numeric_limits<T>::min(), std::numeric_limits<T>::max() }; else { if constexpr (std::is_integral_v<T>) diff --git a/entity/erased-constraints.hpp b/entity/erased-constraints.hpp index c77d8166..2674a619 100644 --- a/entity/erased-constraints.hpp +++ b/entity/erased-constraints.hpp @@ -4,6 +4,13 @@ namespace floormat::entities::erased_constraints { +template<typename T> struct is_magnum_vector_ final : std::false_type {}; +template<std::size_t N, typename T> struct is_magnum_vector_<Math::Vector<N, T>> : std::true_type {}; +template<typename T> struct is_magnum_vector_<Math::Vector2<T>> : std::true_type {}; +template<typename T> struct is_magnum_vector_<Math::Vector3<T>> : std::true_type {}; +template<typename T> struct is_magnum_vector_<Math::Vector4<T>> : std::true_type {}; +template<typename T> constexpr inline bool is_magnum_vector = is_magnum_vector_<T>::value; + struct range final { using U = std::size_t; |
