23 Algorithms library [algorithms]

23.9 Generalized numeric operations [numeric.ops]

23.9.12 Greatest common divisor [numeric.ops.gcd]

template<class M, class N> constexpr common_type_t<M,N> gcd(M m, N n);
Requires: |m| and |n| shall be representable as a value of common_­type_­t<M, N>.
These requirements ensure, for example, that gcd(m, m) is representable as a value of type M.
end note
Remarks: If either M or N is not an integer type, or if either is cv bool, the program is ill-formed.
Returns: Zero when m and n are both zero.
Otherwise, returns the greatest common divisor of |m| and |n|.
Throws: Nothing.