xieite::is_arith<>

Defined in fragment xieite:is_arith
(header-only: <xieite/trait/is_arith.hpp>)


Specifies that a type is arithmetic (integral or floating-point).
Uses two separate concepts instead of std::is_arithmetic in order to be more useful in overload resolution.


Definition

template<typename T>
concept is_arith = std::integral<T> || std::floating_point<T>;


Example

import xieite;

template<xieite::is_arith T>
T add(T a, T b) {
	return a + b;
}

int main() {
	xieite::dump(add(2, 3));
	xieite::dump(add(5.1, 4.6));
}
Output:
5
9.7
View in Compiler Explorer