xo-umbrella2/xo-ratio/include/xo/ratio/numeric_concept.hpp
Roland Conybeare 92df7ca236 Add 'xo-ratio/' from commit 'd18e9afc1d'
git-subtree-dir: xo-ratio
git-subtree-mainline: b4c2b98a88
git-subtree-split: d18e9afc1d
2025-05-10 21:26:39 -05:00

39 lines
1.1 KiB
C++

/** @file numeric_concept.hpp **/
#pragma once
#include <concepts>
namespace xo {
namespace ratio {
/** @concept numeric_concept
* @brief Concept for values that participate in arithmetic operations (+,-,*,/) and comparisons
*
* Intended to include at least:
* - built-in integral and floating-point types
* - big_int<N> from ctbignum
* - boost::rational<U>
* - std::complex<U>
* - xo::unit::quantity<U,R>
*
* Accepting complex numbers --> we don't require T to be totally ordered,
* and don't require (<,<=,>=,>) operators.
*
* Intend numeric_concept to apply to types T suitable for
* xo::ratio::ratio<T>
**/
template <typename T, typename U = T>
concept numeric_concept = requires(T x, U y)
{
{ -x };
{ x - y };
{ x + y };
{ x * y };
{ x / y };
{ x == y };
{ x != y };
};
} /*namespace ratio*/
} /*namespace xo*/
/* end numeric_concept.hpp */