Closed
Description
As a dependency to this project we need a "number" concept. By this I do not mean exactly this name or a concept that have all the constraints in one place. It might be divided to smaller concepts but as an aggregate should at least satisfy something along:
template<typename T>
concept number-ish = std::regular<T> &&
std::totally_ordered<T> &&
requires(T a, T b) {
{ a + b } -> std::same_as<T>;
{ a - b } -> std::same_as<T>;
{ a * b } -> std::same_as<T>;
{ a / b } -> std::same_as<T>;
{ +a } -> std::same_as<T>;
{ -a } -> std::same_as<T>;
{ a += b } -> std::same_as<T&>;
{ a -= b } -> std::same_as<T&>;
{ a *= b } -> std::same_as<T&>;
{ a /= b } -> std::same_as<T&>;
{ T{0} };
};
The above definition is probably wrong. For some operations we should not verify the return type (a * b
might yield a different type than a / b
). We also did not account here for %
, ++v
, v++
operations that work on integral types but not on a floating-point.