1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

make_array 仕様変更

make_common_array 追加
This commit is contained in:
bolero-MURAKAMI 2011-10-30 14:48:10 +09:00
parent cf64e4c457
commit 9a229b824f
2 changed files with 19 additions and 7 deletions

View file

@ -629,11 +629,18 @@ namespace sprout {
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<long double>::table_type sprout::math::detail::factorials<long double>::table;
} // namespace detail
//
// factorial_limit
//
template<typename T>
SPROUT_CONSTEXPR std::size_t factorial_limit() {
return sprout::math::detail::factorials<T>::limit;
}
//
// factorial
//
template<typename T>
SPROUT_CONSTEXPR T factorial(std::size_t x) {
return x <= sprout::math::detail::factorials<T>::limit
return x <= sprout::math::factorial_limit<T>()
? sprout::math::detail::factorials<T>::table[x]
: throw std::invalid_argument("factorial(): argument limit exceeded")
;