From cb23ccdd557fa547aabc85cf5cbec35865043fbf Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Sat, 16 Aug 2014 17:35:36 +0900 Subject: [PATCH] fix index_tuple implementation --- sprout/index_tuple/index_tuple.hpp | 50 ++++++++++++++---------------- sprout/static_assert.hpp | 4 +-- sprout/tuple/tuple/tuple_decl.hpp | 9 +----- 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/sprout/index_tuple/index_tuple.hpp b/sprout/index_tuple/index_tuple.hpp index d92b0d29..b264dfae 100644 --- a/sprout/index_tuple/index_tuple.hpp +++ b/sprout/index_tuple/index_tuple.hpp @@ -24,37 +24,33 @@ namespace sprout { template using uindex_tuple = sprout::integer_sequence; #else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_WORKAROUND_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES) + + namespace detail { + template class Derived, T... Is> + struct integer_sequence_another_base + : public sprout::integer_sequence + { + public: + typedef Derived type; + template + struct rebind + : public Derived + {}; + public: + static SPROUT_CONSTEXPR type make() SPROUT_NOEXCEPT { + return type(); + } + }; + } // namespace detail + template struct index_tuple - : public sprout::integer_sequence - { - public: - typedef index_tuple type; - template - struct rebind - : public index_tuple - {}; - public: - static SPROUT_CONSTEXPR type make() SPROUT_NOEXCEPT { - return type(); - } - }; - + : public sprout::detail::integer_sequence_another_base + {}; template struct uindex_tuple - : public sprout::integer_sequence - { - public: - typedef uindex_tuple type; - template - struct rebind - : public uindex_tuple - {}; - public: - static SPROUT_CONSTEXPR type make() SPROUT_NOEXCEPT { - return type(); - } - }; + : public sprout::detail::integer_sequence_another_base + {}; #endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_WORKAROUND_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES) } // namespace sprout diff --git a/sprout/static_assert.hpp b/sprout/static_assert.hpp index ce7dda9d..040430af 100644 --- a/sprout/static_assert.hpp +++ b/sprout/static_assert.hpp @@ -31,8 +31,8 @@ # define SPROUT_STATIC_ASSERT(...) \ SPROUT_PP_CAT(SPROUT_STATIC_ASSERT_, SPROUT_PP_VARIADIC_SIZE(__VA_ARGS__))(__VA_ARGS__) #else -# define SPROUT_STATIC_ASSERT(expr) \ - SPROUT_STATIC_ASSERT_1(expr) +# define SPROUT_STATIC_ASSERT(COND) \ + SPROUT_STATIC_ASSERT_1(COND) #endif // diff --git a/sprout/tuple/tuple/tuple_decl.hpp b/sprout/tuple/tuple/tuple_decl.hpp index f14dc9d0..f9d648a7 100644 --- a/sprout/tuple/tuple/tuple_decl.hpp +++ b/sprout/tuple/tuple/tuple_decl.hpp @@ -493,14 +493,7 @@ namespace sprout { SPROUT_CXX14_CONSTEXPR tuple& operator=(sprout::pair&& rhs); // tuple swap SPROUT_CXX14_CONSTEXPR void swap(tuple& other) - SPROUT_NOEXCEPT_IF( - sprout::tpp::all_of_c< - SPROUT_NOEXCEPT_EXPR_OR_DEFAULT( - sprout::swap(std::declval(), std::declval()), - (sprout::tuples::detail::dummy_integral_constant::value) - )... - >::value - ) + SPROUT_NOEXCEPT_IF(sprout::tpp::all_of_c(), std::declval()))...>::value) { impl_type::swap(other); }