16 template <
typename U,
typename V>
using gcd_promoted =
decltype(
U() %
V());
26 template <
typename A,
typename B>
28 if (b == 0) {
return a; }
29 return basic_gcd(b, a % b);
40 template <
typename A,
typename B>
constexpr gcd_promoted<A, B>
gcd(A a, B b) {
41 if (a < 0) { a = -a; }
42 if (b == 0) {
return a; }
43 if (b < 0) { b = -b; }
44 return impl::basic_gcd(b, a % b);
constexpr gcd_promoted< A, B > basic_gcd(A a, B b)
Greatest common divisor of two nonnegative numbers.
constexpr gcd_promoted< A, B > gcd(A a, B b)
Greatest common divisor of two numbers; only absolute values are used.
Thomas E. Vaughan's public software.