fix index_tuple implementation

This commit is contained in:
bolero-MURAKAMI 2014-08-16 17:35:36 +09:00
parent 979af136a1
commit cb23ccdd55
3 changed files with 26 additions and 37 deletions

View file

@ -24,37 +24,33 @@ namespace sprout {
template<sprout::uindex_t... Indexes> template<sprout::uindex_t... Indexes>
using uindex_tuple = sprout::integer_sequence<sprout::uindex_t, Indexes...>; using uindex_tuple = sprout::integer_sequence<sprout::uindex_t, Indexes...>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_WORKAROUND_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES) #else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_WORKAROUND_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
namespace detail {
template<typename T, template<T...> class Derived, T... Is>
struct integer_sequence_another_base
: public sprout::integer_sequence<T, Is...>
{
public:
typedef Derived<Is...> type;
template<T... Js>
struct rebind
: public Derived<Js...>
{};
public:
static SPROUT_CONSTEXPR type make() SPROUT_NOEXCEPT {
return type();
}
};
} // namespace detail
template<sprout::index_t... Indexes> template<sprout::index_t... Indexes>
struct index_tuple struct index_tuple
: public sprout::integer_sequence<sprout::index_t, Indexes...> : public sprout::detail::integer_sequence_another_base<sprout::index_t, sprout::index_tuple, Indexes...>
{ {};
public:
typedef index_tuple type;
template<sprout::index_t... J>
struct rebind
: public index_tuple<J...>
{};
public:
static SPROUT_CONSTEXPR type make() SPROUT_NOEXCEPT {
return type();
}
};
template<sprout::uindex_t... Indexes> template<sprout::uindex_t... Indexes>
struct uindex_tuple struct uindex_tuple
: public sprout::integer_sequence<sprout::uindex_t, Indexes...> : public sprout::detail::integer_sequence_another_base<sprout::uindex_t, sprout::uindex_tuple, Indexes...>
{ {};
public:
typedef uindex_tuple type;
template<sprout::uindex_t... J>
struct rebind
: public uindex_tuple<J...>
{};
public:
static SPROUT_CONSTEXPR type make() SPROUT_NOEXCEPT {
return type();
}
};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_WORKAROUND_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES) #endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_WORKAROUND_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout } // namespace sprout

View file

@ -31,8 +31,8 @@
# define SPROUT_STATIC_ASSERT(...) \ # define SPROUT_STATIC_ASSERT(...) \
SPROUT_PP_CAT(SPROUT_STATIC_ASSERT_, SPROUT_PP_VARIADIC_SIZE(__VA_ARGS__))(__VA_ARGS__) SPROUT_PP_CAT(SPROUT_STATIC_ASSERT_, SPROUT_PP_VARIADIC_SIZE(__VA_ARGS__))(__VA_ARGS__)
#else #else
# define SPROUT_STATIC_ASSERT(expr) \ # define SPROUT_STATIC_ASSERT(COND) \
SPROUT_STATIC_ASSERT_1(expr) SPROUT_STATIC_ASSERT_1(COND)
#endif #endif
// //

View file

@ -493,14 +493,7 @@ namespace sprout {
SPROUT_CXX14_CONSTEXPR tuple& operator=(sprout::pair<UType1, UType2>&& rhs); SPROUT_CXX14_CONSTEXPR tuple& operator=(sprout::pair<UType1, UType2>&& rhs);
// tuple swap // tuple swap
SPROUT_CXX14_CONSTEXPR void swap(tuple& other) SPROUT_CXX14_CONSTEXPR void swap(tuple& other)
SPROUT_NOEXCEPT_IF( SPROUT_NOEXCEPT_IF(sprout::tpp::all_of_c<SPROUT_NOEXCEPT_EXPR(sprout::swap(std::declval<Types&>(), std::declval<Types&>()))...>::value)
sprout::tpp::all_of_c<
SPROUT_NOEXCEPT_EXPR_OR_DEFAULT(
sprout::swap(std::declval<Types&>(), std::declval<Types&>()),
(sprout::tuples::detail::dummy_integral_constant<Types, bool, false>::value)
)...
>::value
)
{ {
impl_type::swap(other); impl_type::swap(other);
} }