They are very similar to the C++17 functions std::gcd() and std::lcm(), but do not work with integers of different signedness – a static_assert prevents that. This makes them safer to use because the standard versions cause UB when used with one unsigned integer and one negative integer.
These functions can calculate the greatest common divisor and least common multiple of two integers.
They are very similar to the C++17 functions std::gcd() and std::lcm(), but do not work with integers of different signedness – a static_assert prevents that. This makes them safer to use because the standard versions cause UB when used with one unsigned integer and one negative integer.