File indexing completed on 2025-12-15 09:53:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_DETAIL_TYPE_FOLDR1_HPP
0011 #define BOOST_HANA_DETAIL_TYPE_FOLDR1_HPP
0012
0013 #include <boost/hana/config.hpp>
0014
0015
0016 namespace boost { namespace hana { namespace detail {
0017 template <unsigned n>
0018 struct type_foldr1_t;
0019
0020 template <>
0021 struct type_foldr1_t<0> {
0022 template <
0023 template <typename ...> class f,
0024 typename state
0025 >
0026 using result = state;
0027 };
0028
0029 template <>
0030 struct type_foldr1_t<1> {
0031 template <
0032 template <typename ...> class f,
0033 typename x1,
0034 typename state
0035 >
0036 using result = typename f<x1, state>::type;
0037 };
0038
0039 template <>
0040 struct type_foldr1_t<2> {
0041 template <
0042 template <typename ...> class f,
0043 typename x1, typename x2,
0044 typename state
0045 >
0046 using result = typename f<x1, typename f<x2, state>::type>::type;
0047 };
0048
0049 template <>
0050 struct type_foldr1_t<3> {
0051 template <
0052 template <typename ...> class f,
0053 typename x1, typename x2, typename x3,
0054 typename state
0055 >
0056 using result = typename f<
0057 x1,
0058 typename f<
0059 x2,
0060 typename f<
0061 x3,
0062 state
0063 >::type
0064 >::type
0065 >::type;
0066 };
0067
0068 template <>
0069 struct type_foldr1_t<4> {
0070 template <
0071 template <typename ...> class f,
0072 typename x1, typename x2, typename x3, typename x4,
0073 typename state
0074 >
0075 using result = typename f<
0076 x1,
0077 typename f<
0078 x2,
0079 typename f<
0080 x3,
0081 typename f<
0082 x4,
0083 state
0084 >::type
0085 >::type
0086 >::type
0087 >::type;
0088 };
0089
0090 template <>
0091 struct type_foldr1_t<5> {
0092 template <
0093 template <typename ...> class f,
0094 typename x1, typename x2, typename x3, typename x4, typename x5,
0095 typename state
0096 >
0097 using result = typename f<
0098 x1,
0099 typename f<
0100 x2,
0101 typename f<
0102 x3,
0103 typename f<
0104 x4,
0105 typename f<
0106 x5,
0107 state
0108 >::type
0109 >::type
0110 >::type
0111 >::type
0112 >::type;
0113 };
0114
0115 template <>
0116 struct type_foldr1_t<6> {
0117 template <
0118 template <typename ...> class f,
0119 typename x1, typename x2, typename x3, typename x4, typename x5, typename x6,
0120 typename ...xs
0121 >
0122 using result =
0123 typename f<
0124 x1,
0125 typename f<
0126 x2,
0127 typename f<
0128 x3,
0129 typename f<
0130 x4,
0131 typename f<
0132 x5,
0133 typename type_foldr1_t<(sizeof...(xs) > 6 ? 6 : sizeof...(xs))>::
0134 template result<f, x6, xs...>
0135 >::type
0136 >::type
0137 >::type
0138 >::type
0139 >::type;
0140 };
0141
0142 template <template <typename ...> class f, typename x1, typename ...xn>
0143 struct type_foldr1 {
0144 using type = typename type_foldr1_t<(sizeof...(xn) > 6 ? 6 : sizeof...(xn))>
0145 ::template result<f, x1, xn...>;
0146 };
0147 } }}
0148
0149 #endif