From b37695f1a4a550dbcbabdd5bf0342b4b494048e4 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Fri, 15 May 2015 11:36:21 +0900 Subject: [PATCH] fix implementation --- sprout/stateful/slot.hpp | 68 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/sprout/stateful/slot.hpp b/sprout/stateful/slot.hpp index 16e91e91..c847b365 100644 --- a/sprout/stateful/slot.hpp +++ b/sprout/stateful/slot.hpp @@ -33,10 +33,10 @@ namespace sprout { template struct tag { friend SPROUT_CONSTEXPR int adl_counter(sprout::slot_detail::tag); - friend SPROUT_CONSTEXPR int adl_id(sprout::slot_detail::tag); + friend SPROUT_CONSTEXPR int adl_key(sprout::slot_detail::tag); friend SPROUT_CONSTEXPR std::intmax_t adl_value(sprout::slot_detail::tag); - template - friend SPROUT_CONSTEXPR std::intmax_t adl_get(sprout::slot_detail::tag, sprout::integral_constant); + template + friend SPROUT_CONSTEXPR std::intmax_t adl_get(sprout::slot_detail::tag, sprout::integral_constant); }; #if defined(__clang__) # pragma clang diagnostic pop @@ -45,50 +45,50 @@ namespace sprout { # pragma GCC diagnostic pop #endif - template + template struct state { friend SPROUT_CONSTEXPR int adl_counter(sprout::slot_detail::tag) { return N; } - friend SPROUT_CONSTEXPR int adl_id(sprout::slot_detail::tag) { - return ID; + friend SPROUT_CONSTEXPR int adl_key(sprout::slot_detail::tag) { + return Key; } friend SPROUT_CONSTEXPR std::intmax_t adl_value(sprout::slot_detail::tag) { return Value; } - template - friend SPROUT_CONSTEXPR std::intmax_t adl_get(sprout::slot_detail::tag, sprout::integral_constant) { - return get(); + template + friend SPROUT_CONSTEXPR std::intmax_t adl_get(sprout::slot_detail::tag, sprout::integral_constant) { + return get(); } - template + template static SPROUT_CONSTEXPR std::intmax_t get() { - return I == ID ? Value + return K == Key ? Value : state< N - 1, - adl_id(sprout::slot_detail::tag()), + adl_key(sprout::slot_detail::tag()), adl_value(sprout::slot_detail::tag()) - >::template get() + >::template get() ; } }; - template - struct state<1, ID, Value> { + template + struct state<1, Key, Value> { friend SPROUT_CONSTEXPR int adl_counter(sprout::slot_detail::tag<1>) { return 1; } - friend SPROUT_CONSTEXPR int adl_id(sprout::slot_detail::tag<1>) { - return ID; + friend SPROUT_CONSTEXPR int adl_key(sprout::slot_detail::tag<1>) { + return Key; } friend SPROUT_CONSTEXPR std::intmax_t adl_value(sprout::slot_detail::tag<1>) { return Value; } - template - friend SPROUT_CONSTEXPR std::intmax_t adl_get(sprout::slot_detail::tag<1>, sprout::integral_constant) { - return get(); + template + friend SPROUT_CONSTEXPR std::intmax_t adl_get(sprout::slot_detail::tag<1>, sprout::integral_constant) { + return get(); } - template + template static SPROUT_CONSTEXPR std::intmax_t get() { - return SPROUT_ASSERT(I == ID), Value; + return SPROUT_ASSERT(K == Key), Value; } }; @@ -114,24 +114,24 @@ namespace sprout { return R; } - template(), sprout::integral_constant())> + template(), sprout::integral_constant())> SPROUT_CONSTEXPR std::intmax_t get( int, sprout::slot_detail::tag ) { return R; } - template + template SPROUT_CONSTEXPR std::intmax_t get( long, sprout::slot_detail::tag<0> ) { return 0; } - template + template SPROUT_CONSTEXPR std::intmax_t get( long, sprout::slot_detail::tag, - std::intmax_t R = get(0, sprout::slot_detail::tag()) + std::intmax_t R = get(0, sprout::slot_detail::tag()) ) { return R; @@ -141,9 +141,9 @@ namespace sprout { // slot // template< - int I, + int K, std::size_t Limit = sprout::detail::slot_default_call_limit, - std::intmax_t R = sprout::slot_detail::get(0, sprout::slot_detail::tag()) + std::intmax_t R = sprout::slot_detail::get(0, sprout::slot_detail::tag()) > SPROUT_CONSTEXPR std::intmax_t slot() { return R; @@ -153,23 +153,23 @@ namespace sprout { // assign_slot_return // template< - int I, + int K, std::intmax_t Value, std::size_t Limit = sprout::detail::slot_default_call_limit, std::intmax_t = sprout::slot_detail::state< sprout::slot_detail::counter(0, sprout::slot_detail::tag()) + 1, - I, Value - >::template get() + K, Value + >::template get() > SPROUT_CXX14_CONSTEXPR void assign_slot() {} template< - int I, + int K, std::intmax_t Value, std::size_t Limit = sprout::detail::slot_default_call_limit, std::intmax_t R = sprout::slot_detail::state< sprout::slot_detail::counter(0, sprout::slot_detail::tag()) + 1, - I, Value - >::template get() + K, Value + >::template get() > SPROUT_CONSTEXPR std::intmax_t assign_slot_return() { return R;