- 524 名前:デフォルトの名無しさん mailto:sage [2012/01/21(土) 12:59:38.80 ]
- // func.cpp
namespace { template <unsigned int R> inline BigInt Factor(BigInt const & n) { return n == 0 ? 1 : n * Factor<R - 1>(n - 1); } template <> inline BigInt Factor<0>(BigInt const & n) { return n == 0 ? 1 : n * Factor<256>(n - 1); } } BigInt factor(BigInt const & n) { return Factor<256>(n) ; } // func.hpp BigInt factor(BigInt const & n); こんな感じのコードを見かけたんですけどこのテンプレートになにか意味あるんですか?
|

|