summaryrefslogtreecommitdiffhomepage
path: root/entity/constraints.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-19 14:45:40 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-19 14:45:40 +0100
commit17ee71b537bf65923acc021a1ed382ab76df9f98 (patch)
tree1f6fad88a6a3dc10df29271b18bfae258b515d40 /entity/constraints.hpp
parent9c1d2bb7979776c42248b47832e5a9d71a305e68 (diff)
entity: finish adding non-erased constraints
Now only erased ones remain.
Diffstat (limited to 'entity/constraints.hpp')
-rw-r--r--entity/constraints.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/entity/constraints.hpp b/entity/constraints.hpp
index 171c555a..bc991dfc 100644
--- a/entity/constraints.hpp
+++ b/entity/constraints.hpp
@@ -13,11 +13,12 @@ template<typename T> struct range
using limits = std::numeric_limits<T>;
T min = limits::min(), max = limits::max();
- constexpr operator erased_constraints::range() const;
+ constexpr operator erased_constraints::range() const noexcept;
+ constexpr operator std::pair<T, T>() const noexcept;
};
template<typename T>
-constexpr range<T>::operator erased_constraints::range() const
+constexpr range<T>::operator erased_constraints::range() const noexcept
{
using enum erased_constraints::range::type_;
if constexpr (std::is_floating_point_v<T>)
@@ -29,6 +30,8 @@ constexpr range<T>::operator erased_constraints::range() const
return { {}, {}, type_none };
}
+template<typename T> constexpr range<T>::operator std::pair<T, T>() const noexcept { return { min, max }; }
+
using length = erased_constraints::length;
using group = erased_constraints::group;