detail/ct_gcd_lcm.hpp は2つのコンパイル時アルゴリズムを提供する。 最大公約数と最小公倍数である。
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 | コンパイル時符号なし定整数[5.19/1] |
Expression | Result Type | Value | Precondition |
---|---|---|---|
ct_gcd<A, B>::value | コンパイル時符号なし定整数 | A と B の最大公約数 | A != 0 && B != 0 |
ct_lcm<A, B>::value | コンパイル時符号なし定整数 | A と B の最小公倍数 | A != 0 && B != 0 |
コンパイル時アルゴリズムであるため、事前条件の違反はコンパイル時エラーを招く。
このヘッダーは Boost compile-time algorithms ライブラリに置き換えられるかもしれない。
Copyright © 2000, 2001 Stephen Cleary (shammah@voyager.net)
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.