mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-02-23 10:54:54 +00:00
fix for gcc 4.7~4.8
This commit is contained in:
parent
fa619fc1bf
commit
4fecb5654c
5 changed files with 52 additions and 51 deletions
|
@ -35,43 +35,42 @@ namespace sprout {
|
|||
#endif
|
||||
|
||||
template<int N>
|
||||
struct state {
|
||||
struct state
|
||||
: public sprout::integral_constant<int, N>
|
||||
{
|
||||
friend SPROUT_CONSTEXPR int adl_counter(sprout::counter_detail::tag<N>) {
|
||||
return N;
|
||||
}
|
||||
SPROUT_STATIC_CONSTEXPR int value = N;
|
||||
};
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR_OR_CONST int sprout::counter_detail::state<N>::value;
|
||||
|
||||
template<int N, int = adl_counter(sprout::counter_detail::tag<N>())>
|
||||
SPROUT_CONSTEXPR bool check_impl(int, sprout::counter_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR bool check(int, sprout::counter_detail::tag<N>) {
|
||||
return true;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR bool check_impl(long, sprout::counter_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR bool check(long, sprout::counter_detail::tag<N>) {
|
||||
return false;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR bool check(bool R = sprout::counter_detail::check_impl(0, sprout::counter_detail::tag<N>())) {
|
||||
SPROUT_CONSTEXPR bool check(bool R = sprout::counter_detail::check(0, sprout::counter_detail::tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR int counter_impl(sprout::false_type, sprout::counter_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR int counter(sprout::false_type, sprout::counter_detail::tag<N>) {
|
||||
return 0;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR int counter_impl(
|
||||
SPROUT_CONSTEXPR int counter(
|
||||
sprout::true_type, sprout::counter_detail::tag<N>,
|
||||
int R = !sprout::counter_detail::check<N>() ? N
|
||||
: counter_impl(sprout::bool_constant<sprout::counter_detail::check<N>()>(), sprout::counter_detail::tag<N + 1>())
|
||||
: counter(sprout::bool_constant<sprout::counter_detail::check<N>()>(), sprout::counter_detail::tag<N + 1>())
|
||||
)
|
||||
{
|
||||
return R;
|
||||
}
|
||||
template<int N = 0>
|
||||
SPROUT_CONSTEXPR int counter(int R = sprout::counter_detail::counter_impl(sprout::true_type(), sprout::counter_detail::tag<N>())) {
|
||||
SPROUT_CONSTEXPR int counter(int R = sprout::counter_detail::counter(sprout::true_type(), sprout::counter_detail::tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
} // namespace counter_detail
|
||||
|
|
|
@ -144,33 +144,33 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR_OR_CONST int sprout::rand_detail::state<0, IsSrand, Seed>::value;
|
||||
|
||||
template<int N, int = adl_counter(sprout::rand_detail::tag<N>())>
|
||||
SPROUT_CONSTEXPR bool check_impl(int, sprout::rand_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR bool check(int, sprout::rand_detail::tag<N>) {
|
||||
return true;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR bool check_impl(long, sprout::rand_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR bool check(long, sprout::rand_detail::tag<N>) {
|
||||
return false;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR bool check(bool R = sprout::rand_detail::check_impl(0, sprout::rand_detail::tag<N>())) {
|
||||
SPROUT_CONSTEXPR bool check(bool R = sprout::rand_detail::check(0, sprout::rand_detail::tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR int counter_impl(sprout::false_type, sprout::rand_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR int counter(sprout::false_type, sprout::rand_detail::tag<N>) {
|
||||
return 0;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR int counter_impl(
|
||||
SPROUT_CONSTEXPR int counter(
|
||||
sprout::true_type, sprout::rand_detail::tag<N>,
|
||||
int R = !sprout::rand_detail::check<N>() ? N
|
||||
: counter_impl(sprout::bool_constant<sprout::rand_detail::check<N>()>(), sprout::rand_detail::tag<N + 1>())
|
||||
: counter(sprout::bool_constant<sprout::rand_detail::check<N>()>(), sprout::rand_detail::tag<N + 1>())
|
||||
)
|
||||
{
|
||||
return R;
|
||||
}
|
||||
template<int N = 0>
|
||||
SPROUT_CONSTEXPR int counter(int R = sprout::rand_detail::counter_impl(sprout::true_type(), sprout::rand_detail::tag<N>())) {
|
||||
SPROUT_CONSTEXPR int counter(int R = sprout::rand_detail::counter(sprout::true_type(), sprout::rand_detail::tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
} // namespace rand_detail
|
||||
|
|
|
@ -92,33 +92,33 @@ namespace sprout {
|
|||
};
|
||||
|
||||
template<int N, int = adl_counter(sprout::slot_detail::tag<N>())>
|
||||
SPROUT_CONSTEXPR bool check_impl(int, sprout::slot_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR bool check(int, sprout::slot_detail::tag<N>) {
|
||||
return true;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR bool check_impl(long, sprout::slot_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR bool check(long, sprout::slot_detail::tag<N>) {
|
||||
return false;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR bool check(bool R = sprout::slot_detail::check_impl(0, sprout::slot_detail::tag<N>())) {
|
||||
SPROUT_CONSTEXPR bool check(bool R = sprout::slot_detail::check(0, sprout::slot_detail::tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR int counter_impl(sprout::false_type, sprout::slot_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR int counter(sprout::false_type, sprout::slot_detail::tag<N>) {
|
||||
return 0;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR int counter_impl(
|
||||
SPROUT_CONSTEXPR int counter(
|
||||
sprout::true_type, sprout::slot_detail::tag<N>,
|
||||
int R = !sprout::slot_detail::check_impl(0, sprout::slot_detail::tag<N>()) ? N
|
||||
: counter_impl(sprout::bool_constant<sprout::slot_detail::check_impl(0, sprout::slot_detail::tag<N>())>(), sprout::slot_detail::tag<N + 1>())
|
||||
int R = !sprout::slot_detail::check(0, sprout::slot_detail::tag<N>()) ? N
|
||||
: counter(sprout::bool_constant<sprout::slot_detail::check(0, sprout::slot_detail::tag<N>())>(), sprout::slot_detail::tag<N + 1>())
|
||||
)
|
||||
{
|
||||
return R;
|
||||
}
|
||||
template<int N = 0>
|
||||
SPROUT_CONSTEXPR int counter(int R = sprout::slot_detail::counter_impl(sprout::true_type(), sprout::slot_detail::tag<N>())) {
|
||||
SPROUT_CONSTEXPR int counter(int R = sprout::slot_detail::counter(sprout::true_type(), sprout::slot_detail::tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
|
||||
|
@ -156,16 +156,18 @@ namespace sprout {
|
|||
//
|
||||
template<
|
||||
int K, std::intmax_t Value,
|
||||
int N = 0,
|
||||
std::intmax_t = sprout::slot_detail::state<
|
||||
sprout::slot_detail::counter(),
|
||||
sprout::slot_detail::counter(sprout::true_type(), sprout::slot_detail::tag<N>()),
|
||||
K, Value
|
||||
>::value
|
||||
>
|
||||
SPROUT_CXX14_CONSTEXPR void assign_slot() {}
|
||||
template<
|
||||
int K, std::intmax_t Value,
|
||||
int N = 0,
|
||||
std::intmax_t R = sprout::slot_detail::state<
|
||||
sprout::slot_detail::counter(),
|
||||
sprout::slot_detail::counter(sprout::true_type(), sprout::slot_detail::tag<N>()),
|
||||
K, Value
|
||||
>::value
|
||||
>
|
||||
|
|
|
@ -47,33 +47,33 @@ namespace sprout {
|
|||
};
|
||||
|
||||
template<int N, int = adl_counter(tag<N>())>
|
||||
static SPROUT_CONSTEXPR bool check_impl(int, tag<N>) {
|
||||
static SPROUT_CONSTEXPR bool check(int, tag<N>) {
|
||||
return true;
|
||||
}
|
||||
template<int N>
|
||||
static SPROUT_CONSTEXPR bool check_impl(long, tag<N>) {
|
||||
static SPROUT_CONSTEXPR bool check(long, tag<N>) {
|
||||
return false;
|
||||
}
|
||||
template<int N>
|
||||
static SPROUT_CONSTEXPR bool check(bool R = check_impl(0, tag<N>())) {
|
||||
static SPROUT_CONSTEXPR bool check(bool R = check(0, tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
|
||||
template<int N>
|
||||
static SPROUT_CONSTEXPR int counter_impl(sprout::false_type, tag<N>) {
|
||||
static SPROUT_CONSTEXPR int counter(sprout::false_type, tag<N>) {
|
||||
return 0;
|
||||
}
|
||||
template<int N>
|
||||
static SPROUT_CONSTEXPR int counter_impl(
|
||||
static SPROUT_CONSTEXPR int counter(
|
||||
sprout::true_type, tag<N>,
|
||||
int R = !check<N>() ? N
|
||||
: counter_impl(sprout::bool_constant<check<N>()>(), tag<N + 1>())
|
||||
: counter(sprout::bool_constant<check<N>()>(), tag<N + 1>())
|
||||
)
|
||||
{
|
||||
return R;
|
||||
}
|
||||
template<int N = 0>
|
||||
static SPROUT_CONSTEXPR int counter(int R = counter_impl(sprout::true_type(), tag<N>())) {
|
||||
static SPROUT_CONSTEXPR int counter(int R = counter(sprout::true_type(), tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,33 +93,33 @@ namespace sprout {
|
|||
};
|
||||
|
||||
template<int N, int = adl_counter(sprout::typed_slot_detail::tag<N>())>
|
||||
SPROUT_CONSTEXPR bool check_impl(int, sprout::typed_slot_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR bool check(int, sprout::typed_slot_detail::tag<N>) {
|
||||
return true;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR bool check_impl(long, sprout::typed_slot_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR bool check(long, sprout::typed_slot_detail::tag<N>) {
|
||||
return false;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR bool check(bool R = sprout::typed_slot_detail::check_impl(0, sprout::typed_slot_detail::tag<N>())) {
|
||||
SPROUT_CONSTEXPR bool check(bool R = sprout::typed_slot_detail::check(0, sprout::typed_slot_detail::tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR int counter_impl(sprout::false_type, sprout::typed_slot_detail::tag<N>) {
|
||||
SPROUT_CONSTEXPR int counter(sprout::false_type, sprout::typed_slot_detail::tag<N>) {
|
||||
return 0;
|
||||
}
|
||||
template<int N>
|
||||
SPROUT_CONSTEXPR int counter_impl(
|
||||
SPROUT_CONSTEXPR int counter(
|
||||
sprout::true_type, sprout::typed_slot_detail::tag<N>,
|
||||
int R = !sprout::typed_slot_detail::check<N>() ? N
|
||||
: counter_impl(sprout::bool_constant<sprout::typed_slot_detail::check<N>()>(), sprout::typed_slot_detail::tag<N + 1>())
|
||||
int R = !sprout::typed_slot_detail::check(0, sprout::typed_slot_detail::tag<N>()) ? N
|
||||
: counter(sprout::bool_constant<sprout::typed_slot_detail::check(0, sprout::typed_slot_detail::tag<N>())>(), sprout::typed_slot_detail::tag<N + 1>())
|
||||
)
|
||||
{
|
||||
return R;
|
||||
}
|
||||
template<int N = 0>
|
||||
SPROUT_CONSTEXPR int counter(int R = sprout::typed_slot_detail::counter_impl(sprout::true_type(), sprout::typed_slot_detail::tag<N>())) {
|
||||
SPROUT_CONSTEXPR int counter(int R = sprout::typed_slot_detail::counter(sprout::true_type(), sprout::typed_slot_detail::tag<N>())) {
|
||||
return R;
|
||||
}
|
||||
|
||||
|
@ -130,8 +130,8 @@ namespace sprout {
|
|||
template<int K, int N>
|
||||
SPROUT_CONSTEXPR std::intmax_t get_impl(
|
||||
sprout::true_type, sprout::typed_slot_detail::tag<N>,
|
||||
std::intmax_t R = !sprout::typed_slot_detail::check<N>() ? adl_get(sprout::typed_slot_detail::tag<N - 1>(), sprout::integral_constant<int, K>())
|
||||
: get_impl<K>(sprout::bool_constant<sprout::typed_slot_detail::check<N>()>(), sprout::typed_slot_detail::tag<N + 1>())
|
||||
std::intmax_t R = !sprout::typed_slot_detail::check(0, sprout::typed_slot_detail::tag<N>()) ? adl_get(sprout::typed_slot_detail::tag<N - 1>(), sprout::integral_constant<int, K>())
|
||||
: get_impl<K>(sprout::bool_constant<sprout::typed_slot_detail::check(0, sprout::typed_slot_detail::tag<N>())>(), sprout::typed_slot_detail::tag<N + 1>())
|
||||
)
|
||||
{
|
||||
return R;
|
||||
|
@ -156,19 +156,19 @@ namespace sprout {
|
|||
// assign_slot_return
|
||||
//
|
||||
template<
|
||||
typename T,
|
||||
std::intmax_t Value,
|
||||
typename T, std::intmax_t Value,
|
||||
int N = 0,
|
||||
std::intmax_t = sprout::typed_slot_detail::state<
|
||||
sprout::typed_slot_detail::counter(),
|
||||
sprout::typed_slot_detail::counter(sprout::true_type(), sprout::typed_slot_detail::tag<N>()),
|
||||
sprout::typed_id<T>::value, Value
|
||||
>::value
|
||||
>
|
||||
SPROUT_CXX14_CONSTEXPR void assign_slot() {}
|
||||
template<
|
||||
typename T,
|
||||
std::intmax_t Value,
|
||||
typename T, std::intmax_t Value,
|
||||
int N = 0,
|
||||
std::intmax_t R = sprout::typed_slot_detail::state<
|
||||
sprout::typed_slot_detail::counter(),
|
||||
sprout::typed_slot_detail::counter(sprout::true_type(), sprout::typed_slot_detail::tag<N>()),
|
||||
sprout::typed_id<T>::value, Value
|
||||
>::value
|
||||
>
|
||||
|
|
Loading…
Add table
Reference in a new issue