diff --git a/sprout/type/joint_types.hpp b/sprout/type/joint_types.hpp index a3f412e8..93270366 100644 --- a/sprout/type/joint_types.hpp +++ b/sprout/type/joint_types.hpp @@ -20,6 +20,86 @@ namespace sprout { namespace types { namespace detail { + template + struct is_tuple_like + : public sprout::false_type + {}; + template class TupleClass, typename... Ts> + struct is_tuple_like > + : public sprout::true_type + {}; + template + struct is_tuple_like + : public sprout::types::detail::is_tuple_like + {}; + template + struct is_tuple_like + : public sprout::types::detail::is_tuple_like + {}; + template + struct is_tuple_like + : public sprout::types::detail::is_tuple_like + {}; + + template + struct is_integer_sequence_like + : public sprout::false_type + {}; + template class IntegerSequenceClass, typename T, T... Vs> + struct is_integer_sequence_like > + : public sprout::true_type + {}; + template + struct is_integer_sequence_like + : public sprout::types::detail::is_integer_sequence_like + {}; + template + struct is_integer_sequence_like + : public sprout::types::detail::is_integer_sequence_like + {}; + template + struct is_integer_sequence_like + : public sprout::types::detail::is_integer_sequence_like + {}; + + template + struct is_specific_integer_sequence_like + : public sprout::false_type + {}; +#define SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(TYPE) \ + template class SpecificIntegerSequenceClass, TYPE... Vs> \ + struct is_specific_integer_sequence_like > \ + : public sprout::true_type \ + {} + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(bool); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(char); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(signed char); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(unsigned char); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(char16_t); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(char32_t); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(wchar_t); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(short); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(unsigned short); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(int); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(unsigned int); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(long); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(unsigned long); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(long long); + SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL(unsigned long long); +#undef SPROUT_TYPES_DETAIL_IS_SPECIFIC_INTEGER_SEQUENCE_DECL + template + struct is_specific_integer_sequence_like + : public sprout::types::detail::is_specific_integer_sequence_like + {}; + template + struct is_specific_integer_sequence_like + : public sprout::types::detail::is_specific_integer_sequence_like + {}; + template + struct is_specific_integer_sequence_like + : public sprout::types::detail::is_specific_integer_sequence_like + {}; + template struct joint_types_impl { private: @@ -48,28 +128,33 @@ namespace sprout { {}; }; - template + template< + typename Tuple, typename Tup, + bool = sprout::types::detail::is_tuple_like::value, + bool = sprout::types::detail::is_integer_sequence_like::value, + bool = sprout::types::detail::is_specific_integer_sequence_like::value + > struct joint_types_default_apply; template< template class TupleClass, typename... Ts, typename Tup > - struct joint_types_default_apply, Tup> + struct joint_types_default_apply, Tup, false, false, false> : public sprout::types::detail::joint_types_impl, Tup> {}; template< template class TupleClass, typename... Ts, template class TupClass, typename... Types > - struct joint_types_default_apply, TupClass > + struct joint_types_default_apply, TupClass, true, false, false> : public sprout::identity > {}; template< template class TupleClass, typename... Ts, template class IntSeqClass, typename Type, Type... Values > - struct joint_types_default_apply, IntSeqClass > + struct joint_types_default_apply, IntSeqClass, false, true, false> : public sprout::identity...> > {}; #define SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_TUPLE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(TYPE) \ @@ -77,7 +162,7 @@ namespace sprout { template class TupleClass, typename... Ts, \ template class IntSeqClass, TYPE... Values \ > \ - struct joint_types_default_apply, IntSeqClass > \ + struct joint_types_default_apply, IntSeqClass, false, false, true> \ : public sprout::identity...> > \ {} @@ -113,21 +198,21 @@ namespace sprout { template class IntegerSequenceClass, typename T, T... Vs, typename Tup > - struct joint_types_default_apply, Tup> + struct joint_types_default_apply, Tup, false, false, false> : public sprout::types::detail::joint_types_impl, Tup> {}; template< template class IntegerSequenceClass, typename T, T... Vs, template class TupClass, typename... Types > - struct joint_types_default_apply, TupClass > + struct joint_types_default_apply, TupClass, true, false, false> : public sprout::identity > {}; template< template class IntegerSequenceClass, typename T, T... Vs, template class IntSeqClass, typename Type, Type... Values > - struct joint_types_default_apply, IntSeqClass > + struct joint_types_default_apply, IntSeqClass, false, true, false> : public sprout::identity > {}; #define SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(TYPE) \ @@ -135,7 +220,7 @@ namespace sprout { template class IntegerSequenceClass, typename T, T... Vs, \ template class IntSeqClass, TYPE... Values \ > \ - struct joint_types_default_apply, IntSeqClass > \ + struct joint_types_default_apply, IntSeqClass, false, false, true> \ : public sprout::identity > \ {} SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_INTEGER_SEQUENCE_LIKE_DECL_FOR_CERTAIN_INTEGER_SEQUENCE(bool); @@ -154,6 +239,7 @@ namespace sprout { 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 class IntegerSequenceClass, typename T, T... Vs> struct joint_types_default > { public: @@ -168,7 +254,7 @@ namespace sprout { template class IntegerSequenceClass, BASE... Vs, \ template class IntSeqClass, TYPE... Values \ > \ - struct joint_types_default_apply, IntSeqClass > \ + struct joint_types_default_apply, IntSeqClass, false, false, true> \ : public sprout::identity > \ {} #if SPROUT_USE_UNICODE_LITERALS @@ -209,21 +295,21 @@ namespace sprout { template class IntegerSequenceClass, BASE... Vs, \ typename Tup \ > \ - struct joint_types_default_apply, Tup> \ + struct joint_types_default_apply, Tup, false, false, false> \ : public sprout::types::detail::joint_types_impl, Tup> \ {}; \ template< \ template class IntegerSequenceClass, BASE... Vs, \ template class TupClass, typename... Types \ > \ - struct joint_types_default_apply, TupClass > \ + struct joint_types_default_apply, TupClass, true, false, false> \ : public sprout::identity > \ {}; \ template< \ template class IntegerSequenceClass, BASE... Vs, \ template class IntSeqClass, typename Type, Type... Values \ > \ - struct joint_types_default_apply, IntSeqClass > \ + struct joint_types_default_apply, IntSeqClass, false, true, false> \ : public sprout::identity > \ {}; \ SPROUT_TYPES_DETAIL_JOINT_TYPES_DEFAULT_APPLY_CERTAIN_INTEGER_SEQUENCE_DECL_(BASE); \