mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-25 21:35:41 +00:00
static データメンバの修正
This commit is contained in:
parent
99f1a4f741
commit
e6cda7492c
7 changed files with 604 additions and 612 deletions
|
@ -179,6 +179,10 @@ namespace sprout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::array<T, N>::size_type sprout::array<T, N>::static_size;
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::array<T, N>::size_type sprout::array<T, N>::fixed_size;
|
||||||
|
|
||||||
//
|
//
|
||||||
// operator==
|
// operator==
|
||||||
|
@ -266,11 +270,9 @@ namespace sprout {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename T, typename Enable = void>
|
template<typename T, typename Enable = void>
|
||||||
struct is_array_impl {
|
struct is_array_impl
|
||||||
public:
|
: public std::false_type
|
||||||
typedef std::false_type type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct is_array_impl<
|
struct is_array_impl<
|
||||||
T,
|
T,
|
||||||
|
@ -280,11 +282,9 @@ namespace sprout {
|
||||||
sprout::array<typename T::value_type, T::static_size>
|
sprout::array<typename T::value_type, T::static_size>
|
||||||
>::value
|
>::value
|
||||||
>::type
|
>::type
|
||||||
> {
|
>
|
||||||
public:
|
: public std::true_type
|
||||||
typedef std::true_type type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
//
|
//
|
||||||
// is_array
|
// is_array
|
||||||
|
|
|
@ -19,7 +19,17 @@ namespace sprout {
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 5;
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 5;
|
||||||
public:
|
public:
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
6,
|
||||||
|
24,
|
||||||
|
120
|
||||||
|
}};
|
||||||
};
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<std::int8_t>::table_type sprout::math::detail::factorials<std::int8_t>::table;
|
||||||
template<>
|
template<>
|
||||||
struct factorials<std::uint8_t> {
|
struct factorials<std::uint8_t> {
|
||||||
public:
|
public:
|
||||||
|
@ -28,7 +38,17 @@ namespace sprout {
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 5;
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 5;
|
||||||
public:
|
public:
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
6,
|
||||||
|
24,
|
||||||
|
120
|
||||||
|
}};
|
||||||
};
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<std::uint8_t>::table_type sprout::math::detail::factorials<std::uint8_t>::table;
|
||||||
template<>
|
template<>
|
||||||
struct factorials<std::int16_t> {
|
struct factorials<std::int16_t> {
|
||||||
public:
|
public:
|
||||||
|
@ -37,96 +57,8 @@ namespace sprout {
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 7;
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 7;
|
||||||
public:
|
public:
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct factorials<std::uint16_t> {
|
|
||||||
public:
|
public:
|
||||||
typedef std::uint16_t type;
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 8;
|
|
||||||
public:
|
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct factorials<std::int32_t> {
|
|
||||||
public:
|
|
||||||
typedef std::int32_t type;
|
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 11;
|
|
||||||
public:
|
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct factorials<std::uint32_t> {
|
|
||||||
public:
|
|
||||||
typedef std::uint32_t type;
|
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 11;
|
|
||||||
public:
|
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct factorials<std::int64_t> {
|
|
||||||
public:
|
|
||||||
typedef std::int64_t type;
|
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 20;
|
|
||||||
public:
|
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct factorials<std::uint64_t> {
|
|
||||||
public:
|
|
||||||
typedef std::uint64_t type;
|
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 20;
|
|
||||||
public:
|
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct factorials<float> {
|
|
||||||
public:
|
|
||||||
typedef float type;
|
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 34;
|
|
||||||
public:
|
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct factorials<double> {
|
|
||||||
public:
|
|
||||||
typedef double type;
|
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 170;
|
|
||||||
public:
|
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct factorials<long double> {
|
|
||||||
public:
|
|
||||||
typedef long double type;
|
|
||||||
public:
|
|
||||||
SPROUT_STATIC_CONSTEXPR std::size_t limit = 170;
|
|
||||||
public:
|
|
||||||
typedef sprout::array<type, limit + 1> table_type;
|
|
||||||
};
|
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<std::int8_t>::table_type factorial_table_i8 = factorials<std::int8_t>::table_type{{
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
6,
|
|
||||||
24,
|
|
||||||
120
|
|
||||||
}};
|
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<std::uint8_t>::table_type factorial_table_u8 = factorials<std::uint8_t>::table_type{{
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
6,
|
|
||||||
24,
|
|
||||||
120
|
|
||||||
}};
|
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<std::int16_t>::table_type factorial_table_i16 = factorials<std::int16_t>::table_type{{
|
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
@ -136,7 +68,18 @@ namespace sprout {
|
||||||
720,
|
720,
|
||||||
5040
|
5040
|
||||||
}};
|
}};
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<std::uint16_t>::table_type factorial_table_u16 = factorials<std::uint16_t>::table_type{{
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<std::int16_t>::table_type sprout::math::detail::factorials<std::int16_t>::table;
|
||||||
|
template<>
|
||||||
|
struct factorials<std::uint16_t> {
|
||||||
|
public:
|
||||||
|
typedef std::uint16_t type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 8;
|
||||||
|
public:
|
||||||
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
@ -147,7 +90,18 @@ namespace sprout {
|
||||||
5040,
|
5040,
|
||||||
40320
|
40320
|
||||||
}};
|
}};
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<std::int32_t>::table_type factorial_table_i32 = factorials<std::int32_t>::table_type{{
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<std::uint16_t>::table_type sprout::math::detail::factorials<std::uint16_t>::table;
|
||||||
|
template<>
|
||||||
|
struct factorials<std::int32_t> {
|
||||||
|
public:
|
||||||
|
typedef std::int32_t type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 11;
|
||||||
|
public:
|
||||||
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
@ -161,7 +115,18 @@ namespace sprout {
|
||||||
3628800,
|
3628800,
|
||||||
39916800
|
39916800
|
||||||
}};
|
}};
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<std::uint32_t>::table_type factorial_table_u32 = factorials<std::uint32_t>::table_type{{
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<std::int32_t>::table_type sprout::math::detail::factorials<std::int32_t>::table;
|
||||||
|
template<>
|
||||||
|
struct factorials<std::uint32_t> {
|
||||||
|
public:
|
||||||
|
typedef std::uint32_t type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 11;
|
||||||
|
public:
|
||||||
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
@ -175,7 +140,18 @@ namespace sprout {
|
||||||
3628800,
|
3628800,
|
||||||
39916800
|
39916800
|
||||||
}};
|
}};
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<std::int64_t>::table_type factorial_table_i64 = factorials<std::int64_t>::table_type{{
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<std::uint32_t>::table_type sprout::math::detail::factorials<std::uint32_t>::table;
|
||||||
|
template<>
|
||||||
|
struct factorials<std::int64_t> {
|
||||||
|
public:
|
||||||
|
typedef std::int64_t type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 20;
|
||||||
|
public:
|
||||||
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
INT64_C(1),
|
INT64_C(1),
|
||||||
INT64_C(1),
|
INT64_C(1),
|
||||||
INT64_C(2),
|
INT64_C(2),
|
||||||
|
@ -198,7 +174,18 @@ namespace sprout {
|
||||||
INT64_C(121645100408832000),
|
INT64_C(121645100408832000),
|
||||||
INT64_C(2432902008176640000)
|
INT64_C(2432902008176640000)
|
||||||
}};
|
}};
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<std::uint64_t>::table_type factorial_table_u64 = factorials<std::uint64_t>::table_type{{
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<std::int64_t>::table_type sprout::math::detail::factorials<std::int64_t>::table;
|
||||||
|
template<>
|
||||||
|
struct factorials<std::uint64_t> {
|
||||||
|
public:
|
||||||
|
typedef std::uint64_t type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 20;
|
||||||
|
public:
|
||||||
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
UINT64_C(1),
|
UINT64_C(1),
|
||||||
UINT64_C(1),
|
UINT64_C(1),
|
||||||
UINT64_C(2),
|
UINT64_C(2),
|
||||||
|
@ -221,7 +208,18 @@ namespace sprout {
|
||||||
UINT64_C(121645100408832000),
|
UINT64_C(121645100408832000),
|
||||||
UINT64_C(2432902008176640000)
|
UINT64_C(2432902008176640000)
|
||||||
}};
|
}};
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<float>::table_type factorial_table_f = factorials<float>::table_type{{
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<std::uint64_t>::table_type sprout::math::detail::factorials<std::uint64_t>::table;
|
||||||
|
template<>
|
||||||
|
struct factorials<float> {
|
||||||
|
public:
|
||||||
|
typedef float type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 34;
|
||||||
|
public:
|
||||||
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
1.0F,
|
1.0F,
|
||||||
1.0F,
|
1.0F,
|
||||||
2.0F,
|
2.0F,
|
||||||
|
@ -258,7 +256,18 @@ namespace sprout {
|
||||||
0.868331761881188649551819440128e37F,
|
0.868331761881188649551819440128e37F,
|
||||||
0.29523279903960414084761860964352e39F
|
0.29523279903960414084761860964352e39F
|
||||||
}};
|
}};
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<double>::table_type factorial_table_d = factorials<double>::table_type{{
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<float>::table_type sprout::math::detail::factorials<float>::table;
|
||||||
|
template<>
|
||||||
|
struct factorials<double> {
|
||||||
|
public:
|
||||||
|
typedef double type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 170;
|
||||||
|
public:
|
||||||
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
1.0,
|
1.0,
|
||||||
1.0,
|
1.0,
|
||||||
2.0,
|
2.0,
|
||||||
|
@ -431,7 +440,18 @@ namespace sprout {
|
||||||
0.4269068009004705274939251888899566538069e305,
|
0.4269068009004705274939251888899566538069e305,
|
||||||
0.7257415615307998967396728211129263114717e307
|
0.7257415615307998967396728211129263114717e307
|
||||||
}};
|
}};
|
||||||
SPROUT_STATIC_CONSTEXPR factorials<long double>::table_type factorial_table_ld = factorials<long double>::table_type{{
|
};
|
||||||
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<double>::table_type sprout::math::detail::factorials<double>::table;
|
||||||
|
template<>
|
||||||
|
struct factorials<long double> {
|
||||||
|
public:
|
||||||
|
typedef long double type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR std::size_t limit = 170;
|
||||||
|
public:
|
||||||
|
typedef sprout::array<type, limit + 1> table_type;
|
||||||
|
public:
|
||||||
|
SPROUT_STATIC_CONSTEXPR table_type table = table_type{{
|
||||||
1.0L,
|
1.0L,
|
||||||
1.0L,
|
1.0L,
|
||||||
2.0L,
|
2.0L,
|
||||||
|
@ -604,52 +624,8 @@ namespace sprout {
|
||||||
0.4269068009004705274939251888899566538069e305L,
|
0.4269068009004705274939251888899566538069e305L,
|
||||||
0.7257415615307998967396728211129263114717e307L
|
0.7257415615307998967396728211129263114717e307L
|
||||||
}};
|
}};
|
||||||
template<typename T>
|
};
|
||||||
SPROUT_CONSTEXPR T factorial_impl(std::size_t x);
|
SPROUT_CONSTEXPR typename sprout::math::detail::factorials<long double>::table_type sprout::math::detail::factorials<long double>::table;
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR std::int8_t factorial_impl<std::int8_t>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_i8[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR std::uint8_t factorial_impl<std::uint8_t>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_u8[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR std::int16_t factorial_impl<std::int16_t>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_i16[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR std::uint16_t factorial_impl<std::uint16_t>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_u16[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR std::int32_t factorial_impl<std::int32_t>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_i32[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR std::uint32_t factorial_impl<std::uint32_t>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_u32[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR std::int64_t factorial_impl<std::int64_t>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_i64[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR std::uint64_t factorial_impl<std::uint64_t>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_u64[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR float factorial_impl<float>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_f[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR double factorial_impl<double>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_d[x];
|
|
||||||
}
|
|
||||||
template<>
|
|
||||||
SPROUT_CONSTEXPR long double factorial_impl<long double>(std::size_t x) {
|
|
||||||
return sprout::math::detail::factorial_table_ld[x];
|
|
||||||
}
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
//
|
//
|
||||||
// factorial
|
// factorial
|
||||||
|
@ -657,7 +633,7 @@ namespace sprout {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
SPROUT_CONSTEXPR T factorial(std::size_t x) {
|
SPROUT_CONSTEXPR T factorial(std::size_t x) {
|
||||||
return x <= sprout::math::detail::factorials<T>::limit
|
return x <= sprout::math::detail::factorials<T>::limit
|
||||||
? sprout::math::detail::factorial_impl<T>(x)
|
? sprout::math::detail::factorials<T>::table[x]
|
||||||
: throw "assert(x <= sprout::math::detail::factorials<T>::limit)"
|
: throw "assert(x <= sprout::math::detail::factorials<T>::limit)"
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -668,4 +644,3 @@ namespace sprout {
|
||||||
|
|
||||||
#endif // #ifndef SPROUT_MATH_FACTORIAL_HPP
|
#endif // #ifndef SPROUT_MATH_FACTORIAL_HPP
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,10 @@ namespace sprout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
template<typename Container>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::null_array<Container>::size_type sprout::null_array<Container>::static_size;
|
||||||
|
template<typename Container>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::null_array<Container>::size_type sprout::null_array<Container>::fixed_size;
|
||||||
|
|
||||||
//
|
//
|
||||||
// operator==
|
// operator==
|
||||||
|
|
|
@ -65,8 +65,7 @@ namespace sprout {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
SPROUT_CONSTEXPR linear_congruential_engine()
|
SPROUT_CONSTEXPR linear_congruential_engine()
|
||||||
//: x_(init_seed(default_seed)) // ???
|
: x_(init_seed(default_seed))
|
||||||
: x_(init_seed(1))
|
|
||||||
{}
|
{}
|
||||||
SPROUT_CONSTEXPR explicit linear_congruential_engine(IntType const& x0)
|
SPROUT_CONSTEXPR explicit linear_congruential_engine(IntType const& x0)
|
||||||
: x_(init_seed(x0))
|
: x_(init_seed(x0))
|
||||||
|
@ -111,6 +110,14 @@ namespace sprout {
|
||||||
return lhs << rhs.x_;
|
return lhs << rhs.x_;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
template<typename IntType, IntType a, IntType c, IntType m>
|
||||||
|
SPROUT_CONSTEXPR IntType sprout::random::linear_congruential_engine<IntType, a, c, m>::multiplier;
|
||||||
|
template<typename IntType, IntType a, IntType c, IntType m>
|
||||||
|
SPROUT_CONSTEXPR IntType sprout::random::linear_congruential_engine<IntType, a, c, m>::increment;
|
||||||
|
template<typename IntType, IntType a, IntType c, IntType m>
|
||||||
|
SPROUT_CONSTEXPR IntType sprout::random::linear_congruential_engine<IntType, a, c, m>::modulus;
|
||||||
|
template<typename IntType, IntType a, IntType c, IntType m>
|
||||||
|
SPROUT_CONSTEXPR IntType sprout::random::linear_congruential_engine<IntType, a, c, m>::default_seed;
|
||||||
|
|
||||||
//
|
//
|
||||||
// minstd_rand0
|
// minstd_rand0
|
||||||
|
|
|
@ -15,22 +15,7 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
// mersenne_twister_engine
|
// mersenne_twister_engine
|
||||||
//
|
//
|
||||||
template<
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
typename UIntType,
|
|
||||||
std::size_t w,
|
|
||||||
std::size_t n,
|
|
||||||
std::size_t m,
|
|
||||||
std::size_t r,
|
|
||||||
UIntType a,
|
|
||||||
std::size_t u,
|
|
||||||
UIntType d,
|
|
||||||
std::size_t s,
|
|
||||||
UIntType b,
|
|
||||||
std::size_t t,
|
|
||||||
UIntType c,
|
|
||||||
std::size_t l,
|
|
||||||
UIntType f
|
|
||||||
>
|
|
||||||
class mersenne_twister_engine {
|
class mersenne_twister_engine {
|
||||||
public:
|
public:
|
||||||
typedef UIntType result_type;
|
typedef UIntType result_type;
|
||||||
|
@ -326,8 +311,7 @@ namespace sprout {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
SPROUT_CONSTEXPR mersenne_twister_engine()
|
SPROUT_CONSTEXPR mersenne_twister_engine()
|
||||||
//: x_(init_seed(default_seed)) // ???
|
: x_(init_seed(default_seed))
|
||||||
: x_(init_seed(5489u))
|
|
||||||
, i_(n)
|
, i_(n)
|
||||||
{}
|
{}
|
||||||
SPROUT_CONSTEXPR explicit mersenne_twister_engine(UIntType const& value)
|
SPROUT_CONSTEXPR explicit mersenne_twister_engine(UIntType const& value)
|
||||||
|
@ -387,6 +371,34 @@ namespace sprout {
|
||||||
return lhs;
|
return lhs;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR std::size_t sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::word_size;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR std::size_t sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::state_size;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR std::size_t sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::shift_size;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR std::size_t sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::mask_bits;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR UIntType sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::xor_mask;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR std::size_t sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::tempering_u;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR UIntType sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::tempering_d;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR std::size_t sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::tempering_s;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR UIntType sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::tempering_b;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR std::size_t sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::tempering_t;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR UIntType sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::tempering_c;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR std::size_t sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::tempering_l;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR UIntType sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::initialization_multiplier;
|
||||||
|
template<typename UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
|
||||||
|
SPROUT_CONSTEXPR UIntType sprout::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::default_seed;
|
||||||
|
|
||||||
//
|
//
|
||||||
// mt11213b
|
// mt11213b
|
||||||
|
|
|
@ -170,11 +170,9 @@ namespace sprout {
|
||||||
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
|
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
|
||||||
private:
|
private:
|
||||||
template<typename U, typename Enable = void>
|
template<typename U, typename Enable = void>
|
||||||
struct is_index_iterator_impl {
|
struct is_index_iterator_impl
|
||||||
public:
|
: public std::false_type
|
||||||
typedef std::false_type type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
template<typename U>
|
template<typename U>
|
||||||
struct is_index_iterator_impl<
|
struct is_index_iterator_impl<
|
||||||
U,
|
U,
|
||||||
|
@ -188,11 +186,9 @@ namespace sprout {
|
||||||
value_type
|
value_type
|
||||||
>::value
|
>::value
|
||||||
>::type
|
>::type
|
||||||
> {
|
>
|
||||||
public:
|
: public std::true_type
|
||||||
typedef std::true_type type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
template<typename U>
|
template<typename U>
|
||||||
struct is_index_iterator
|
struct is_index_iterator
|
||||||
: public is_index_iterator_impl<U>
|
: public is_index_iterator_impl<U>
|
||||||
|
@ -565,6 +561,12 @@ namespace sprout {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
template<typename T, std::size_t N, typename Traits>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::basic_string<T, N, Traits>::size_type sprout::basic_string<T, N, Traits>::npos;
|
||||||
|
template<typename T, std::size_t N, typename Traits>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::basic_string<T, N, Traits>::size_type sprout::basic_string<T, N, Traits>::static_size;
|
||||||
|
template<typename T, std::size_t N, typename Traits>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::basic_string<T, N, Traits>::size_type sprout::basic_string<T, N, Traits>::fixed_size;
|
||||||
|
|
||||||
//
|
//
|
||||||
// operator==
|
// operator==
|
||||||
|
@ -963,11 +965,9 @@ namespace sprout {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename T, typename Enable = void>
|
template<typename T, typename Enable = void>
|
||||||
struct is_basic_string_impl {
|
struct is_basic_string_impl
|
||||||
public:
|
: public std::false_type
|
||||||
typedef std::integral_constant<bool, false> type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct is_basic_string_impl<
|
struct is_basic_string_impl<
|
||||||
T,
|
T,
|
||||||
|
@ -977,11 +977,9 @@ namespace sprout {
|
||||||
sprout::basic_string<typename T::value_type, T::static_size, typename T::traits_type>
|
sprout::basic_string<typename T::value_type, T::static_size, typename T::traits_type>
|
||||||
>::value
|
>::value
|
||||||
>::type
|
>::type
|
||||||
> {
|
>
|
||||||
public:
|
: public std::true_type
|
||||||
typedef std::integral_constant<bool, true> type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
//
|
//
|
||||||
// is_basic_string
|
// is_basic_string
|
||||||
|
@ -993,11 +991,9 @@ namespace sprout {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename T, typename Elem, typename Enable = void>
|
template<typename T, typename Elem, typename Enable = void>
|
||||||
struct is_string_of_impl {
|
struct is_string_of_impl
|
||||||
public:
|
: public std::false_type
|
||||||
typedef std::integral_constant<bool, false> type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
template<typename T, typename Elem>
|
template<typename T, typename Elem>
|
||||||
struct is_string_of_impl<
|
struct is_string_of_impl<
|
||||||
T,
|
T,
|
||||||
|
@ -1008,11 +1004,9 @@ namespace sprout {
|
||||||
sprout::basic_string<Elem, T::static_size>
|
sprout::basic_string<Elem, T::static_size>
|
||||||
>::value
|
>::value
|
||||||
>::type
|
>::type
|
||||||
> {
|
>
|
||||||
public:
|
: public std::true_type
|
||||||
typedef std::integral_constant<bool, true> type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
//
|
//
|
||||||
// is_string_of
|
// is_string_of
|
||||||
|
|
|
@ -379,6 +379,10 @@ namespace sprout {
|
||||||
return impl_type::template to_const_param<Container>(array_);
|
return impl_type::template to_const_param<Container>(array_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
template<typename Container>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::sub_array<Container>::size_type sprout::sub_array<Container>::static_size;
|
||||||
|
template<typename Container>
|
||||||
|
SPROUT_CONSTEXPR typename sprout::sub_array<Container>::size_type sprout::sub_array<Container>::fixed_size;
|
||||||
|
|
||||||
//
|
//
|
||||||
// operator==
|
// operator==
|
||||||
|
@ -564,11 +568,9 @@ namespace sprout {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename T, typename Enable = void>
|
template<typename T, typename Enable = void>
|
||||||
struct is_sub_array_impl {
|
struct is_sub_array_impl
|
||||||
public:
|
: public std::false_type
|
||||||
typedef std::integral_constant<bool, false> type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct is_sub_array_impl<
|
struct is_sub_array_impl<
|
||||||
T,
|
T,
|
||||||
|
@ -578,11 +580,9 @@ namespace sprout {
|
||||||
sprout::sub_array<typename T::container_type>
|
sprout::sub_array<typename T::container_type>
|
||||||
>::value
|
>::value
|
||||||
>::type
|
>::type
|
||||||
> {
|
>
|
||||||
public:
|
: public std::true_type
|
||||||
typedef std::integral_constant<bool, true> type;
|
{};
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
//
|
//
|
||||||
// is_sub_array
|
// is_sub_array
|
||||||
|
|
Loading…
Reference in a new issue