1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix types::joint_types, types::rebind_types implementations

This commit is contained in:
bolero-MURAKAMI 2014-08-07 19:11:41 +09:00
parent 39bb8e8ada
commit 22b1ac3f62
3 changed files with 232 additions and 133 deletions

View file

@ -9,6 +9,7 @@
#define SPROUT_TYPE_JOINT_TYPES_HPP
#include <sprout/config.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/index_tuple/index_tuple.hpp>
#include <sprout/tuple/indexes.hpp>
@ -38,10 +39,6 @@ namespace sprout {
typename sprout::tuple_indexes<Tup>::type
>::type type;
};
template<typename Tuple, typename Tup>
struct joint_types_default_apply;
template<typename Tuple>
struct joint_types_default {
public:
@ -51,16 +48,60 @@ namespace sprout {
{};
};
template<typename Tuple, typename Tup>
struct joint_types_default_apply;
template<
template<typename...> class TupleClass, typename... Ts,
typename Tup
>
struct joint_types_default_apply<TupleClass<Ts...>, Tup>
: public sprout::types::detail::joint_types_impl<TupleClass<Ts...>, Tup>
{};
template<
template<typename...> class TupleClass, typename... Ts,
template<typename...> class TupClass, typename... Types
>
struct joint_types_default_apply<TupleClass<Ts...>, TupClass<Types...> >
: public sprout::identity<TupleClass<Ts..., Types...> >
{};
template<
template<typename...> class TupleClass, typename... Ts,
template<typename VType, VType...> class IntSeqClass, typename Type, Type... Values
>
struct joint_types_default_apply<TupleClass<Ts...>, IntSeqClass<Type, Values...> >
: public sprout::identity<TupleClass<Ts..., sprout::integral_constant<Type, Values>...> >
{};
#define SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(TYPE) \
template< \
template<typename...> class TupleClass, typename... Ts, \
template<TYPE...> class IntSeqClass, TYPE... Values \
> \
struct joint_types_default_apply<TupleClass<Ts...>, IntSeqClass<Values...> > \
: public sprout::identity<TupleClass<Ts..., sprout::integral_constant<TYPE, Values>...> > \
{}
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(bool);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(signed char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(char16_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(char32_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(wchar_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(short);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned short);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(int);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned int);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(long long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned long long);
#undef SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE
template<template<typename...> class TupleClass, typename... Ts>
struct joint_types_default<TupleClass<Ts...> > {
public:
template<typename Tup>
struct apply
: public sprout::types::detail::joint_types_impl<TupleClass<Ts...>, Tup>
{};
template<template<typename...> class TupClass, typename... Types>
struct apply<TupClass<Types...> >
: public sprout::identity<TupleClass<Ts..., Types...> >
: public sprout::types::detail::joint_types_default_apply<TupleClass<Ts...>, Tup>
{};
};
@ -71,27 +112,44 @@ namespace sprout {
struct joint_types_default_apply<IntegerSequenceClass<T, Vs...>, Tup>
: public sprout::types::detail::joint_types_impl<IntegerSequenceClass<T, Vs...>, Tup>
{};
template<
template<typename VT, VT...> class IntegerSequenceClass, typename T, T... Vs,
template<typename...> class TupClass, typename... Types
>
struct joint_types_default_apply<IntegerSequenceClass<T, Vs...>, TupClass<Types...> >
: public sprout::identity<IntegerSequenceClass<T, Vs..., Types::value...> >
{};
template<
template<typename VT, VT...> class IntegerSequenceClass, typename T, T... Vs,
template<typename VType, VType...> class IntSeqClass, typename Type, Type... Values
>
>
struct joint_types_default_apply<IntegerSequenceClass<T, Vs...>, IntSeqClass<Type, Values...> >
: public sprout::identity<IntegerSequenceClass<T, Vs..., Values...> >
{};
template<
template<typename VT, VT...> class IntegerSequenceClass, typename T, T... Vs,
template<sprout::index_t...> class IndexTupClass, sprout::index_t... Values
>
struct joint_types_default_apply<IntegerSequenceClass<T, Vs...>, IndexTupClass<Values...> >
: public sprout::identity<IntegerSequenceClass<T, Vs..., Values...> >
{};
template<
template<typename VT, VT...> class IntegerSequenceClass, typename T, T... Vs,
template<sprout::uindex_t...> class UIndexTupClass, sprout::uindex_t... Values
>
struct joint_types_default_apply<IntegerSequenceClass<T, Vs...>, UIndexTupClass<Values...> >
: public sprout::identity<IntegerSequenceClass<T, Vs..., Values...> >
{};
#define SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(TYPE) \
template< \
template<typename VT, VT...> class IntegerSequenceClass, typename T, T... Vs, \
template<TYPE...> class IntSeqClass, TYPE... Values \
> \
struct joint_types_default_apply<IntegerSequenceClass<T, Vs...>, IntSeqClass<Values...> > \
: public sprout::identity<IntegerSequenceClass<T, Vs..., Values...> > \
{}
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(bool);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(signed char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(char16_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(char32_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(wchar_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(short);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned short);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(int);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned int);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(long long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(unsigned long long);
#undef SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE
template<template<typename VT, VT...> class IntegerSequenceClass, typename T, T... Vs>
struct joint_types_default<IntegerSequenceClass<T, Vs...> > {
public:
@ -101,79 +159,76 @@ namespace sprout {
{};
};
template<
template<sprout::index_t...> class IndexTupleClass, sprout::index_t... Vs,
typename Tup
>
struct joint_types_default_apply<IndexTupleClass<Vs...>, Tup>
: public sprout::types::detail::joint_types_impl<IndexTupleClass<Vs...>, Tup>
{};
template<
template<sprout::index_t...> class IndexTupleClass, sprout::index_t... Vs,
template<typename VType, VType...> class IntSeqClass, typename Type, Type... Values
>
struct joint_types_default_apply<IndexTupleClass<Vs...>, IntSeqClass<Type, Values...> >
: public sprout::identity<IndexTupleClass<Vs..., Values...> >
{};
template<
template<sprout::index_t...> class IndexTupleClass, sprout::index_t... Vs,
template<sprout::index_t...> class IndexTupClass, sprout::index_t... Values
>
struct joint_types_default_apply<IndexTupleClass<Vs...>, IndexTupClass<Values...> >
: public sprout::identity<IndexTupleClass<Vs..., Values...> >
{};
template<
template<sprout::index_t...> class IndexTupleClass, sprout::index_t... Vs,
template<sprout::uindex_t...> class UIndexTupClass, sprout::uindex_t... Values
>
struct joint_types_default_apply<IndexTupleClass<Vs...>, UIndexTupClass<Values...> >
: public sprout::identity<IndexTupleClass<Vs..., Values...> >
{};
template<template<sprout::index_t...> class IndexTupleClass, sprout::index_t... Vs>
struct joint_types_default<IndexTupleClass<Vs...> > {
public:
template<typename Tup>
struct apply
: public sprout::types::detail::joint_types_default_apply<IndexTupleClass<Vs...>, Tup>
{};
};
template<
template<sprout::uindex_t...> class UIndexTupleClass, sprout::uindex_t... Vs,
typename Tup
>
struct joint_types_default_apply<UIndexTupleClass<Vs...>, Tup>
: public sprout::types::detail::joint_types_impl<UIndexTupleClass<Vs...>, Tup>
{};
template<
template<sprout::uindex_t...> class UIndexTupleClass, sprout::uindex_t... Vs,
template<typename VType, VType...> class IntSeqClass, typename Type, Type... Values
>
struct joint_types_default_apply<UIndexTupleClass<Vs...>, IntSeqClass<Type, Values...> >
: public sprout::identity<UIndexTupleClass<Vs..., Values...> >
{};
template<
template<sprout::uindex_t...> class UIndexTupleClass, sprout::uindex_t... Vs,
template<sprout::index_t...> class IndexTupClass, sprout::index_t... Values
>
struct joint_types_default_apply<UIndexTupleClass<Vs...>, IndexTupClass<Values...> >
: public sprout::identity<UIndexTupleClass<Vs..., Values...> >
{};
template<
template<sprout::uindex_t...> class UIndexTupleClass, sprout::uindex_t... Vs,
template<sprout::uindex_t...> class UIndexTupClass, sprout::uindex_t... Values
>
struct joint_types_default_apply<UIndexTupleClass<Vs...>, UIndexTupClass<Values...> >
: public sprout::identity<UIndexTupleClass<Vs..., Values...> >
{};
template<template<sprout::uindex_t...> class UIndexTupleClass, sprout::uindex_t... Vs>
struct joint_types_default<UIndexTupleClass<Vs...> > {
public:
template<typename Tup>
struct apply
: public sprout::types::detail::joint_types_default_apply<UIndexTupleClass<Vs...>, Tup>
{};
};
#define SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, TYPE) \
template< \
template<BASE...> class IntegerSequenceClass, BASE... Vs, \
template<TYPE...> class IntSeqClass, TYPE... Values \
> \
struct joint_types_default_apply<IntegerSequenceClass<Vs...>, IntSeqClass<Values...> > \
: public sprout::identity<IntegerSequenceClass<Vs..., Values...> > \
{}
#define SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(BASE) \
template< \
template<BASE...> class IntegerSequenceClass, BASE... Vs, \
typename Tup \
> \
struct joint_types_default_apply<IntegerSequenceClass<Vs...>, Tup> \
: public sprout::types::detail::joint_types_impl<IntegerSequenceClass<Vs...>, Tup> \
{}; \
template< \
template<BASE...> class IntegerSequenceClass, BASE... Vs, \
template<typename...> class TupClass, typename... Types \
> \
struct joint_types_default_apply<IntegerSequenceClass<Vs...>, TupClass<Types...> > \
: public sprout::identity<IntegerSequenceClass<Vs..., Types::value...> > \
{}; \
template< \
template<BASE...> class IntegerSequenceClass, BASE... Vs, \
template<typename VType, VType...> class IntSeqClass, typename Type, Type... Values \
> \
struct joint_types_default_apply<IntegerSequenceClass<Vs...>, IntSeqClass<Type, Values...> > \
: public sprout::identity<IntegerSequenceClass<Vs..., Values...> > \
{}; \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, bool); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, char); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, signed char); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, unsigned char); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, char16_t); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, char32_t); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, wchar_t); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, short); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, unsigned short); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, int); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, unsigned int); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, long); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, unsigned long); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, long long); \
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(BASE, unsigned long long); \
template<template<BASE...> class IntegerSequenceClass, BASE... Vs> \
struct joint_types_default<IntegerSequenceClass<Vs...> > { \
public: \
template<typename Tup> \
struct apply \
: public sprout::types::detail::joint_types_default_apply<IntegerSequenceClass<Vs...>, Tup> \
{}; \
}
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(bool);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(signed char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(unsigned char);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(char16_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(char32_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(wchar_t);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(short);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(unsigned short);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(int);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(unsigned int);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(unsigned long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(long long);
SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL(unsigned long long);
#undef SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE
#undef SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL
} // namespace detail
//

View file

@ -33,22 +33,34 @@ namespace sprout {
: public sprout::identity<IntegerSequenceClass<T, Types::value...> >
{};
};
template<template<sprout::index_t...> class IndexTupleClass, sprout::index_t... Vs>
struct rebind_types_default<IndexTupleClass<Vs...> > {
public:
template<typename... Types>
struct apply
: public sprout::identity<IndexTupleClass<Types::value...> >
{};
};
template<template<sprout::uindex_t...> class UIndexTupleClass, sprout::uindex_t... Vs>
struct rebind_types_default<UIndexTupleClass<Vs...> > {
public:
template<typename... Types>
struct apply
: public sprout::identity<UIndexTupleClass<Types::value...> >
{};
};
#define SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(TYPE) \
template<template<TYPE...> class IndexTupleClass, TYPE... Vs> \
struct rebind_types_default<IndexTupleClass<Vs...> > { \
public: \
template<typename... Types> \
struct apply \
: public sprout::identity<IndexTupleClass<Types::value...> > \
{}; \
}
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(bool);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(char);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(signed char);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(unsigned char);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(char16_t);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(char32_t);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(wchar_t);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(short);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(unsigned short);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(int);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(unsigned int);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(long);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(unsigned long);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(long long);
SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL(unsigned long long);
#undef SPROUT_TYPES_DETAIL_REBIND_TYPES_DEFAULT_INTEGER_SEQUENCE_LIKE_DECL
} // namespace detail
//

View file

@ -42,31 +42,47 @@ namespace sprout {
//
namespace detail {
template<typename Tuple>
struct tuple_size_impl
struct tuple_size_default_impl
: public sprout::detail::nil_base
{};
template<template<typename...> class TupleClass, typename... Ts>
struct tuple_size_impl<TupleClass<Ts...> >
struct tuple_size_default_impl<TupleClass<Ts...> >
: public sprout::integral_constant<std::size_t, sizeof...(Ts)>
{};
template<template<typename VT, VT...> class IntegerSequenceClass, typename T, T... Vs>
struct tuple_size_impl<IntegerSequenceClass<T, Vs...> >
: public sprout::integral_constant<std::size_t, sizeof...(Vs)>
{};
template<template<sprout::index_t...> class IndexTupleClass, sprout::index_t... Vs>
struct tuple_size_impl<IndexTupleClass<Vs...> >
: public sprout::integral_constant<std::size_t, sizeof...(Vs)>
{};
template<template<sprout::uindex_t...> class UIndexTupleClass, sprout::uindex_t... Vs>
struct tuple_size_impl<UIndexTupleClass<Vs...> >
struct tuple_size_default_impl<IntegerSequenceClass<T, Vs...> >
: public sprout::integral_constant<std::size_t, sizeof...(Vs)>
{};
#define SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(TYPE) \
template<template<TYPE...> class IntegerSequenceClass, TYPE... Vs> \
struct tuple_size_default_impl<IntegerSequenceClass<Vs...> > \
: public sprout::integral_constant<std::size_t, sizeof...(Vs)> \
{}
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(bool);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(char);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(signed char);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned char);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(char16_t);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(char32_t);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(wchar_t);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(short);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned short);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(int);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned int);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(long);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned long);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(long long);
SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned long long);
#undef SPROUT_TYPES_DETAIL_TUPLE_SIZE_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL
template<typename Tuple, bool = sprout::has_value<sprout::tuples::tuple_size<Tuple> >::value>
struct tuple_size_default;
template<typename Tuple>
struct tuple_size_default<Tuple, false>
: public sprout::types::detail::tuple_size_impl<Tuple>
: public sprout::types::detail::tuple_size_default_impl<Tuple>
{};
template<typename Tuple>
struct tuple_size_default<Tuple, true>
@ -94,14 +110,30 @@ namespace sprout {
struct tuple_element_default_impl<I, IntegerSequenceClass<T, Vs...> >
: public std::tuple_element<I, sprout::types::type_tuple<sprout::integral_constant<T, Vs>...> >
{};
template<std::size_t I, template<sprout::index_t...> class IndexTupleClass, sprout::index_t... Vs>
struct tuple_element_default_impl<I, IndexTupleClass<Vs...> >
: public std::tuple_element<I, sprout::types::type_tuple<sprout::integral_constant<sprout::index_t, Vs>...> >
{};
template<std::size_t I, template<sprout::uindex_t...> class UIndexTupleClass, sprout::uindex_t... Vs>
struct tuple_element_default_impl<I, UIndexTupleClass<Vs...> >
: public std::tuple_element<I, sprout::types::type_tuple<sprout::integral_constant<sprout::uindex_t, Vs>...> >
{};
#define SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(TYPE) \
template<std::size_t I, template<TYPE...> class IntegerSequenceClass, TYPE... Vs> \
struct tuple_element_default_impl<I, IntegerSequenceClass<Vs...> > \
: public std::tuple_element<I, sprout::types::type_tuple<sprout::integral_constant<TYPE, Vs>...> > \
{}
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(bool);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(char);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(signed char);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned char);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(char16_t);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(char32_t);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(wchar_t);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(short);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned short);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(int);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned int);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(long);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned long);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(long long);
SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL(unsigned long long);
#undef SPROUT_TYPES_DETAIL_TUPLE_ELEMENT_DEFAULT_IMPL_INTEGER_SEQUENCE_LIKE_DECL
template<std::size_t I, typename Tuple, bool = sprout::has_type<sprout::tuples::tuple_element<I, Tuple> >::value>
struct tuple_element_default;