static データメンバの修正

This commit is contained in:
bolero-MURAKAMI 2011-10-10 21:06:34 +09:00
parent 99f1a4f741
commit e6cda7492c
7 changed files with 604 additions and 612 deletions

View file

@ -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

File diff suppressed because it is too large Load diff

View file

@ -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==

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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