File indexing completed on 2025-01-18 09:40:54
0001 #ifndef BOOST_MP11_DETAIL_MP_APPEND_HPP_INCLUDED
0002 #define BOOST_MP11_DETAIL_MP_APPEND_HPP_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <boost/mp11/detail/mp_count.hpp>
0012 #include <boost/mp11/detail/mp_is_value_list.hpp>
0013 #include <boost/mp11/detail/mp_list.hpp>
0014 #include <boost/mp11/detail/mp_list_v.hpp>
0015 #include <boost/mp11/utility.hpp>
0016 #include <boost/mp11/detail/config.hpp>
0017
0018 namespace boost
0019 {
0020 namespace mp11
0021 {
0022
0023
0024
0025 namespace detail
0026 {
0027
0028
0029
0030 template<class... L> struct mp_append_impl;
0031
0032 #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 )
0033
0034 template<class... L> struct mp_append_impl
0035 {
0036 };
0037
0038 template<> struct mp_append_impl<>
0039 {
0040 using type = mp_list<>;
0041 };
0042
0043 template<template<class...> class L, class... T> struct mp_append_impl<L<T...>>
0044 {
0045 using type = L<T...>;
0046 };
0047
0048 template<template<class...> class L1, class... T1, template<class...> class L2, class... T2> struct mp_append_impl<L1<T1...>, L2<T2...>>
0049 {
0050 using type = L1<T1..., T2...>;
0051 };
0052
0053 template<template<class...> class L1, class... T1, template<class...> class L2, class... T2, template<class...> class L3, class... T3> struct mp_append_impl<L1<T1...>, L2<T2...>, L3<T3...>>
0054 {
0055 using type = L1<T1..., T2..., T3...>;
0056 };
0057
0058 template<template<class...> class L1, class... T1, template<class...> class L2, class... T2, template<class...> class L3, class... T3, template<class...> class L4, class... T4> struct mp_append_impl<L1<T1...>, L2<T2...>, L3<T3...>, L4<T4...>>
0059 {
0060 using type = L1<T1..., T2..., T3..., T4...>;
0061 };
0062
0063 template<template<class...> class L1, class... T1, template<class...> class L2, class... T2, template<class...> class L3, class... T3, template<class...> class L4, class... T4, template<class...> class L5, class... T5, class... Lr> struct mp_append_impl<L1<T1...>, L2<T2...>, L3<T3...>, L4<T4...>, L5<T5...>, Lr...>
0064 {
0065 using type = typename mp_append_impl<L1<T1..., T2..., T3..., T4..., T5...>, Lr...>::type;
0066 };
0067
0068 #else
0069
0070 template<class L1 = mp_list<>, class L2 = mp_list<>, class L3 = mp_list<>, class L4 = mp_list<>, class L5 = mp_list<>, class L6 = mp_list<>, class L7 = mp_list<>, class L8 = mp_list<>, class L9 = mp_list<>, class L10 = mp_list<>, class L11 = mp_list<>> struct append_11_impl
0071 {
0072 };
0073
0074 template<
0075 template<class...> class L1, class... T1,
0076 template<class...> class L2, class... T2,
0077 template<class...> class L3, class... T3,
0078 template<class...> class L4, class... T4,
0079 template<class...> class L5, class... T5,
0080 template<class...> class L6, class... T6,
0081 template<class...> class L7, class... T7,
0082 template<class...> class L8, class... T8,
0083 template<class...> class L9, class... T9,
0084 template<class...> class L10, class... T10,
0085 template<class...> class L11, class... T11>
0086
0087 struct append_11_impl<L1<T1...>, L2<T2...>, L3<T3...>, L4<T4...>, L5<T5...>, L6<T6...>, L7<T7...>, L8<T8...>, L9<T9...>, L10<T10...>, L11<T11...>>
0088 {
0089 using type = L1<T1..., T2..., T3..., T4..., T5..., T6..., T7..., T8..., T9..., T10..., T11...>;
0090 };
0091
0092 template<
0093
0094 class L00 = mp_list<>, class L01 = mp_list<>, class L02 = mp_list<>, class L03 = mp_list<>, class L04 = mp_list<>, class L05 = mp_list<>, class L06 = mp_list<>, class L07 = mp_list<>, class L08 = mp_list<>, class L09 = mp_list<>, class L0A = mp_list<>,
0095 class L10 = mp_list<>, class L11 = mp_list<>, class L12 = mp_list<>, class L13 = mp_list<>, class L14 = mp_list<>, class L15 = mp_list<>, class L16 = mp_list<>, class L17 = mp_list<>, class L18 = mp_list<>, class L19 = mp_list<>,
0096 class L20 = mp_list<>, class L21 = mp_list<>, class L22 = mp_list<>, class L23 = mp_list<>, class L24 = mp_list<>, class L25 = mp_list<>, class L26 = mp_list<>, class L27 = mp_list<>, class L28 = mp_list<>, class L29 = mp_list<>,
0097 class L30 = mp_list<>, class L31 = mp_list<>, class L32 = mp_list<>, class L33 = mp_list<>, class L34 = mp_list<>, class L35 = mp_list<>, class L36 = mp_list<>, class L37 = mp_list<>, class L38 = mp_list<>, class L39 = mp_list<>,
0098 class L40 = mp_list<>, class L41 = mp_list<>, class L42 = mp_list<>, class L43 = mp_list<>, class L44 = mp_list<>, class L45 = mp_list<>, class L46 = mp_list<>, class L47 = mp_list<>, class L48 = mp_list<>, class L49 = mp_list<>,
0099 class L50 = mp_list<>, class L51 = mp_list<>, class L52 = mp_list<>, class L53 = mp_list<>, class L54 = mp_list<>, class L55 = mp_list<>, class L56 = mp_list<>, class L57 = mp_list<>, class L58 = mp_list<>, class L59 = mp_list<>,
0100 class L60 = mp_list<>, class L61 = mp_list<>, class L62 = mp_list<>, class L63 = mp_list<>, class L64 = mp_list<>, class L65 = mp_list<>, class L66 = mp_list<>, class L67 = mp_list<>, class L68 = mp_list<>, class L69 = mp_list<>,
0101 class L70 = mp_list<>, class L71 = mp_list<>, class L72 = mp_list<>, class L73 = mp_list<>, class L74 = mp_list<>, class L75 = mp_list<>, class L76 = mp_list<>, class L77 = mp_list<>, class L78 = mp_list<>, class L79 = mp_list<>,
0102 class L80 = mp_list<>, class L81 = mp_list<>, class L82 = mp_list<>, class L83 = mp_list<>, class L84 = mp_list<>, class L85 = mp_list<>, class L86 = mp_list<>, class L87 = mp_list<>, class L88 = mp_list<>, class L89 = mp_list<>,
0103 class L90 = mp_list<>, class L91 = mp_list<>, class L92 = mp_list<>, class L93 = mp_list<>, class L94 = mp_list<>, class L95 = mp_list<>, class L96 = mp_list<>, class L97 = mp_list<>, class L98 = mp_list<>, class L99 = mp_list<>,
0104 class LA0 = mp_list<>, class LA1 = mp_list<>, class LA2 = mp_list<>, class LA3 = mp_list<>, class LA4 = mp_list<>, class LA5 = mp_list<>, class LA6 = mp_list<>, class LA7 = mp_list<>, class LA8 = mp_list<>, class LA9 = mp_list<>
0105
0106 > struct append_111_impl
0107 {
0108 using type = typename append_11_impl<
0109
0110 typename append_11_impl<L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, L0A>::type,
0111 typename append_11_impl<mp_list<>, L10, L11, L12, L13, L14, L15, L16, L17, L18, L19>::type,
0112 typename append_11_impl<mp_list<>, L20, L21, L22, L23, L24, L25, L26, L27, L28, L29>::type,
0113 typename append_11_impl<mp_list<>, L30, L31, L32, L33, L34, L35, L36, L37, L38, L39>::type,
0114 typename append_11_impl<mp_list<>, L40, L41, L42, L43, L44, L45, L46, L47, L48, L49>::type,
0115 typename append_11_impl<mp_list<>, L50, L51, L52, L53, L54, L55, L56, L57, L58, L59>::type,
0116 typename append_11_impl<mp_list<>, L60, L61, L62, L63, L64, L65, L66, L67, L68, L69>::type,
0117 typename append_11_impl<mp_list<>, L70, L71, L72, L73, L74, L75, L76, L77, L78, L79>::type,
0118 typename append_11_impl<mp_list<>, L80, L81, L82, L83, L84, L85, L86, L87, L88, L89>::type,
0119 typename append_11_impl<mp_list<>, L90, L91, L92, L93, L94, L95, L96, L97, L98, L99>::type,
0120 typename append_11_impl<mp_list<>, LA0, LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9>::type
0121
0122 >::type;
0123 };
0124
0125 template<
0126
0127 class L00, class L01, class L02, class L03, class L04, class L05, class L06, class L07, class L08, class L09, class L0A,
0128 class L10, class L11, class L12, class L13, class L14, class L15, class L16, class L17, class L18, class L19,
0129 class L20, class L21, class L22, class L23, class L24, class L25, class L26, class L27, class L28, class L29,
0130 class L30, class L31, class L32, class L33, class L34, class L35, class L36, class L37, class L38, class L39,
0131 class L40, class L41, class L42, class L43, class L44, class L45, class L46, class L47, class L48, class L49,
0132 class L50, class L51, class L52, class L53, class L54, class L55, class L56, class L57, class L58, class L59,
0133 class L60, class L61, class L62, class L63, class L64, class L65, class L66, class L67, class L68, class L69,
0134 class L70, class L71, class L72, class L73, class L74, class L75, class L76, class L77, class L78, class L79,
0135 class L80, class L81, class L82, class L83, class L84, class L85, class L86, class L87, class L88, class L89,
0136 class L90, class L91, class L92, class L93, class L94, class L95, class L96, class L97, class L98, class L99,
0137 class LA0, class LA1, class LA2, class LA3, class LA4, class LA5, class LA6, class LA7, class LA8, class LA9,
0138 class... Lr
0139
0140 > struct append_inf_impl
0141 {
0142 using prefix = typename append_111_impl<
0143
0144 L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, L0A,
0145 L10, L11, L12, L13, L14, L15, L16, L17, L18, L19,
0146 L20, L21, L22, L23, L24, L25, L26, L27, L28, L29,
0147 L30, L31, L32, L33, L34, L35, L36, L37, L38, L39,
0148 L40, L41, L42, L43, L44, L45, L46, L47, L48, L49,
0149 L50, L51, L52, L53, L54, L55, L56, L57, L58, L59,
0150 L60, L61, L62, L63, L64, L65, L66, L67, L68, L69,
0151 L70, L71, L72, L73, L74, L75, L76, L77, L78, L79,
0152 L80, L81, L82, L83, L84, L85, L86, L87, L88, L89,
0153 L90, L91, L92, L93, L94, L95, L96, L97, L98, L99,
0154 LA0, LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9
0155
0156 >::type;
0157
0158 using type = typename mp_append_impl<prefix, Lr...>::type;
0159 };
0160
0161 #if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 )
0162
0163 template<class... L>
0164 struct mp_append_impl_cuda_workaround
0165 {
0166 using type = mp_if_c<(sizeof...(L) > 111), mp_quote<append_inf_impl>, mp_if_c<(sizeof...(L) > 11), mp_quote<append_111_impl>, mp_quote<append_11_impl> > >;
0167 };
0168
0169 template<class... L> struct mp_append_impl: mp_append_impl_cuda_workaround<L...>::type::template fn<L...>
0170 {
0171 };
0172
0173 #else
0174
0175 template<class... L> struct mp_append_impl:
0176 mp_cond<
0177 mp_bool<(sizeof...(L) > 111)>, mp_quote<append_inf_impl>,
0178 mp_bool<(sizeof...(L) > 11)>, mp_quote<append_111_impl>,
0179 mp_true, mp_quote<append_11_impl>
0180 >::template fn<L...>
0181 {
0182 };
0183
0184 #endif
0185
0186 #endif
0187
0188 struct append_type_lists
0189 {
0190 template<class... L> using fn = typename mp_append_impl<L...>::type;
0191 };
0192
0193
0194
0195 #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO)
0196
0197 template<class... L> struct append_value_impl;
0198
0199 template<class L1 = mp_list_v<>, class L2 = mp_list_v<>, class L3 = mp_list_v<>, class L4 = mp_list_v<>, class L5 = mp_list_v<>, class L6 = mp_list_v<>, class L7 = mp_list_v<>, class L8 = mp_list_v<>, class L9 = mp_list_v<>, class L10 = mp_list_v<>, class L11 = mp_list_v<>> struct append_value_11_impl
0200 {
0201 };
0202
0203 template<
0204 template<auto...> class L1, auto... T1,
0205 template<auto...> class L2, auto... T2,
0206 template<auto...> class L3, auto... T3,
0207 template<auto...> class L4, auto... T4,
0208 template<auto...> class L5, auto... T5,
0209 template<auto...> class L6, auto... T6,
0210 template<auto...> class L7, auto... T7,
0211 template<auto...> class L8, auto... T8,
0212 template<auto...> class L9, auto... T9,
0213 template<auto...> class L10, auto... T10,
0214 template<auto...> class L11, auto... T11>
0215
0216 struct append_value_11_impl<L1<T1...>, L2<T2...>, L3<T3...>, L4<T4...>, L5<T5...>, L6<T6...>, L7<T7...>, L8<T8...>, L9<T9...>, L10<T10...>, L11<T11...>>
0217 {
0218 using type = L1<T1..., T2..., T3..., T4..., T5..., T6..., T7..., T8..., T9..., T10..., T11...>;
0219 };
0220
0221 template<
0222
0223 class L00 = mp_list_v<>, class L01 = mp_list_v<>, class L02 = mp_list_v<>, class L03 = mp_list_v<>, class L04 = mp_list_v<>, class L05 = mp_list_v<>, class L06 = mp_list_v<>, class L07 = mp_list_v<>, class L08 = mp_list_v<>, class L09 = mp_list_v<>, class L0A = mp_list_v<>,
0224 class L10 = mp_list_v<>, class L11 = mp_list_v<>, class L12 = mp_list_v<>, class L13 = mp_list_v<>, class L14 = mp_list_v<>, class L15 = mp_list_v<>, class L16 = mp_list_v<>, class L17 = mp_list_v<>, class L18 = mp_list_v<>, class L19 = mp_list_v<>,
0225 class L20 = mp_list_v<>, class L21 = mp_list_v<>, class L22 = mp_list_v<>, class L23 = mp_list_v<>, class L24 = mp_list_v<>, class L25 = mp_list_v<>, class L26 = mp_list_v<>, class L27 = mp_list_v<>, class L28 = mp_list_v<>, class L29 = mp_list_v<>,
0226 class L30 = mp_list_v<>, class L31 = mp_list_v<>, class L32 = mp_list_v<>, class L33 = mp_list_v<>, class L34 = mp_list_v<>, class L35 = mp_list_v<>, class L36 = mp_list_v<>, class L37 = mp_list_v<>, class L38 = mp_list_v<>, class L39 = mp_list_v<>,
0227 class L40 = mp_list_v<>, class L41 = mp_list_v<>, class L42 = mp_list_v<>, class L43 = mp_list_v<>, class L44 = mp_list_v<>, class L45 = mp_list_v<>, class L46 = mp_list_v<>, class L47 = mp_list_v<>, class L48 = mp_list_v<>, class L49 = mp_list_v<>,
0228 class L50 = mp_list_v<>, class L51 = mp_list_v<>, class L52 = mp_list_v<>, class L53 = mp_list_v<>, class L54 = mp_list_v<>, class L55 = mp_list_v<>, class L56 = mp_list_v<>, class L57 = mp_list_v<>, class L58 = mp_list_v<>, class L59 = mp_list_v<>,
0229 class L60 = mp_list_v<>, class L61 = mp_list_v<>, class L62 = mp_list_v<>, class L63 = mp_list_v<>, class L64 = mp_list_v<>, class L65 = mp_list_v<>, class L66 = mp_list_v<>, class L67 = mp_list_v<>, class L68 = mp_list_v<>, class L69 = mp_list_v<>,
0230 class L70 = mp_list_v<>, class L71 = mp_list_v<>, class L72 = mp_list_v<>, class L73 = mp_list_v<>, class L74 = mp_list_v<>, class L75 = mp_list_v<>, class L76 = mp_list_v<>, class L77 = mp_list_v<>, class L78 = mp_list_v<>, class L79 = mp_list_v<>,
0231 class L80 = mp_list_v<>, class L81 = mp_list_v<>, class L82 = mp_list_v<>, class L83 = mp_list_v<>, class L84 = mp_list_v<>, class L85 = mp_list_v<>, class L86 = mp_list_v<>, class L87 = mp_list_v<>, class L88 = mp_list_v<>, class L89 = mp_list_v<>,
0232 class L90 = mp_list_v<>, class L91 = mp_list_v<>, class L92 = mp_list_v<>, class L93 = mp_list_v<>, class L94 = mp_list_v<>, class L95 = mp_list_v<>, class L96 = mp_list_v<>, class L97 = mp_list_v<>, class L98 = mp_list_v<>, class L99 = mp_list_v<>,
0233 class LA0 = mp_list_v<>, class LA1 = mp_list_v<>, class LA2 = mp_list_v<>, class LA3 = mp_list_v<>, class LA4 = mp_list_v<>, class LA5 = mp_list_v<>, class LA6 = mp_list_v<>, class LA7 = mp_list_v<>, class LA8 = mp_list_v<>, class LA9 = mp_list_v<>
0234
0235 > struct append_value_111_impl
0236 {
0237 using type = typename append_value_11_impl<
0238
0239 typename append_value_11_impl<L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, L0A>::type,
0240 typename append_value_11_impl<mp_list_v<>, L10, L11, L12, L13, L14, L15, L16, L17, L18, L19>::type,
0241 typename append_value_11_impl<mp_list_v<>, L20, L21, L22, L23, L24, L25, L26, L27, L28, L29>::type,
0242 typename append_value_11_impl<mp_list_v<>, L30, L31, L32, L33, L34, L35, L36, L37, L38, L39>::type,
0243 typename append_value_11_impl<mp_list_v<>, L40, L41, L42, L43, L44, L45, L46, L47, L48, L49>::type,
0244 typename append_value_11_impl<mp_list_v<>, L50, L51, L52, L53, L54, L55, L56, L57, L58, L59>::type,
0245 typename append_value_11_impl<mp_list_v<>, L60, L61, L62, L63, L64, L65, L66, L67, L68, L69>::type,
0246 typename append_value_11_impl<mp_list_v<>, L70, L71, L72, L73, L74, L75, L76, L77, L78, L79>::type,
0247 typename append_value_11_impl<mp_list_v<>, L80, L81, L82, L83, L84, L85, L86, L87, L88, L89>::type,
0248 typename append_value_11_impl<mp_list_v<>, L90, L91, L92, L93, L94, L95, L96, L97, L98, L99>::type,
0249 typename append_value_11_impl<mp_list_v<>, LA0, LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9>::type
0250
0251 >::type;
0252 };
0253
0254 template<
0255
0256 class L00, class L01, class L02, class L03, class L04, class L05, class L06, class L07, class L08, class L09, class L0A,
0257 class L10, class L11, class L12, class L13, class L14, class L15, class L16, class L17, class L18, class L19,
0258 class L20, class L21, class L22, class L23, class L24, class L25, class L26, class L27, class L28, class L29,
0259 class L30, class L31, class L32, class L33, class L34, class L35, class L36, class L37, class L38, class L39,
0260 class L40, class L41, class L42, class L43, class L44, class L45, class L46, class L47, class L48, class L49,
0261 class L50, class L51, class L52, class L53, class L54, class L55, class L56, class L57, class L58, class L59,
0262 class L60, class L61, class L62, class L63, class L64, class L65, class L66, class L67, class L68, class L69,
0263 class L70, class L71, class L72, class L73, class L74, class L75, class L76, class L77, class L78, class L79,
0264 class L80, class L81, class L82, class L83, class L84, class L85, class L86, class L87, class L88, class L89,
0265 class L90, class L91, class L92, class L93, class L94, class L95, class L96, class L97, class L98, class L99,
0266 class LA0, class LA1, class LA2, class LA3, class LA4, class LA5, class LA6, class LA7, class LA8, class LA9,
0267 class... Lr
0268
0269 > struct append_value_inf_impl
0270 {
0271 using prefix = typename append_value_111_impl<
0272
0273 L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, L0A,
0274 L10, L11, L12, L13, L14, L15, L16, L17, L18, L19,
0275 L20, L21, L22, L23, L24, L25, L26, L27, L28, L29,
0276 L30, L31, L32, L33, L34, L35, L36, L37, L38, L39,
0277 L40, L41, L42, L43, L44, L45, L46, L47, L48, L49,
0278 L50, L51, L52, L53, L54, L55, L56, L57, L58, L59,
0279 L60, L61, L62, L63, L64, L65, L66, L67, L68, L69,
0280 L70, L71, L72, L73, L74, L75, L76, L77, L78, L79,
0281 L80, L81, L82, L83, L84, L85, L86, L87, L88, L89,
0282 L90, L91, L92, L93, L94, L95, L96, L97, L98, L99,
0283 LA0, LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9
0284
0285 >::type;
0286
0287 using type = typename append_value_impl<prefix, Lr...>::type;
0288 };
0289
0290 template<class... L> struct append_value_impl:
0291 mp_cond<
0292 mp_bool<(sizeof...(L) > 111)>, mp_quote<append_value_inf_impl>,
0293 mp_bool<(sizeof...(L) > 11)>, mp_quote<append_value_111_impl>,
0294 mp_true, mp_quote<append_value_11_impl>
0295 >::template fn<L...>
0296 {
0297 };
0298
0299 struct append_value_lists
0300 {
0301 template<class... L> using fn = typename append_value_impl<L...>::type;
0302 };
0303
0304 #endif
0305
0306 }
0307
0308 #if defined(BOOST_MP11_HAS_TEMPLATE_AUTO)
0309
0310 template<class... L> using mp_append = typename mp_if_c<(sizeof...(L) > 0 && sizeof...(L) == mp_count_if<mp_list<L...>, mp_is_value_list>::value), detail::append_value_lists, detail::append_type_lists>::template fn<L...>;
0311
0312 #else
0313
0314 template<class... L> using mp_append = detail::append_type_lists::fn<L...>;
0315
0316 #endif
0317
0318 }
0319 }
0320
0321 #endif