#pragma once #include "erased-constraints.hpp" #include #include #include #include #include #include namespace floormat::entities::constraints { template struct range { using limits = std::numeric_limits; T min = limits::min(), max = limits::max(); constexpr operator erased_constraints::range() const; }; template constexpr range::operator erased_constraints::range() const { using enum erased_constraints::range::type_; if constexpr (std::is_floating_point_v) return { { .f = min }, { .f = max }, type_float }; if constexpr (std::is_integral_v && std::is_unsigned_v) return { {.u = min}, {.u = max}, type_uint }; if constexpr (std::is_integral_v && std::is_signed_v) return { {.i = min}, {.i = max}, type_int }; return { {}, {}, type_none }; } using length = erased_constraints::length; using group = erased_constraints::group; } // namespace floormat::entities::constraints