1#ifndef LIBSBX_MATH_CONCEPTS_HPP_
2#define LIBSBX_MATH_CONCEPTS_HPP_
11template<
typename Type>
12concept numeric = (std::is_integral_v<Type> && !std::is_same_v<Type, bool>) || std::is_floating_point_v<Type>;
16template<
typename Type>
19template<
typename Type>
22template<
typename Type>
23concept floating_point = is_floating_point_v<Type>;
27template<
typename Type>
28struct is_integral : std::bool_constant<std::is_integral_v<Type> && !std::is_same_v<Type, bool>> { };
30template<
typename Type>
33template<
typename Type>
34concept integral = is_integral_v<Type>;
36template<
typename Type>
39template<
typename Type>
42template<
typename Type>
43concept unsigned_integral = is_unsigned_integral_v<Type>;
47template<
typename Type>
48struct is_scalar : std::bool_constant<is_floating_point_v<Type> || is_integral_v<Type>> { };
50template<
typename Type>
53template<
typename Type>
54concept scalar = is_scalar_v<Type>;
61template<
integral Type>
64 template<scalar Other>
65 inline static constexpr auto equal(Type lhs, Other rhs)
noexcept ->
bool {
66 return lhs ==
static_cast<Type
>(rhs);
71template<
floating_po
int Type>
74 inline static constexpr auto epsilon = std::numeric_limits<Type>::epsilon();
76 template<scalar Other>
77 inline static constexpr auto equal(Type lhs, Other rhs)
noexcept ->
bool {
78 return std::abs(lhs -
static_cast<Type
>(rhs)) <= epsilon;
Definition: concepts.hpp:59
Definition: concepts.hpp:17
Definition: concepts.hpp:28
Definition: concepts.hpp:48
Definition: concepts.hpp:37