detail/ct_gcd_lcm.hpp provides two compile-time algorithms: greatest common divisor and least common multiple.
namespace details { namespace pool { template <unsigned A, unsigned B> struct ct_gcd { static const unsigned value = ...; }; template <unsigned A, unsigned B> struct ct_lcm { static const unsigned value = ...; }; } // namespace pool } // namespace details
Symbol | Meaning |
---|---|
A, B | compile-time unsigned integer constants[5.19/1] |
Expression | Result Type | Value | Precondition |
---|---|---|---|
ct_gcd<A, B>::value | compile-time unsigned integer constant | The greatest common divisor of A and B | A != 0 && B != 0 |
ct_lcm<A, B>::value | compile-time unsigned integer constant | The least common multiple of A and B | A != 0 && B != 0 |
Since these are compile-time algorithms, violation of the preconditions will result in a compile-time error.
This header may be replaced by a Boost compile-time algorithms library.
Copyright © 2000, 2001 Stephen Cleary (scleary AT jerviswebb DOT com)
This file can be redistributed and/or modified under the terms found in copyright.html
This software and its documentation is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.