1 #ifndef BOOST_MP11_DETAIL_MP_APPEND_HPP_INCLUDED 2 #define BOOST_MP11_DETAIL_MP_APPEND_HPP_INCLUDED 3 4 // Copyright 2015-2017 Peter Dimov. 5 // 6 // Distributed under the Boost Software License, Version 1.0. 7 // 8 // See accompanying file LICENSE_1_0.txt or copy at 9 // http://www.boost.org/LICENSE_1_0.txt 10 11 #include <boost/mp11/detail/mp_list.hpp> 12 #include <boost/mp11/utility.hpp> 13 #include <boost/mp11/detail/config.hpp> 14 15 namespace boost 16 { 17 namespace mp11 18 { 19 20 // mp_append<L...> 21 22 namespace detail 23 { 24 25 template<class... L> struct mp_append_impl; 26 27 #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) 28 29 template<class... L> struct mp_append_impl 30 { 31 }; 32 33 template<> struct mp_append_impl<> 34 { 35 using type = mp_list<>; 36 }; 37 38 template<template<class...> class L, class... T> struct mp_append_impl<L<T...>> 39 { 40 using type = L<T...>; 41 }; 42 43 template<template<class...> class L1, class... T1, template<class...> class L2, class... T2> struct mp_append_impl<L1<T1...>, L2<T2...>> 44 { 45 using type = L1<T1..., T2...>; 46 }; 47 48 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...>> 49 { 50 using type = L1<T1..., T2..., T3...>; 51 }; 52 53 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...>> 54 { 55 using type = L1<T1..., T2..., T3..., T4...>; 56 }; 57 58 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...> 59 { 60 using type = typename mp_append_impl<L1<T1..., T2..., T3..., T4..., T5...>, Lr...>::type; 61 }; 62 63 #else 64 65 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 66 { 67 }; 68 69 template< 70 template<class...> class L1, class... T1, 71 template<class...> class L2, class... T2, 72 template<class...> class L3, class... T3, 73 template<class...> class L4, class... T4, 74 template<class...> class L5, class... T5, 75 template<class...> class L6, class... T6, 76 template<class...> class L7, class... T7, 77 template<class...> class L8, class... T8, 78 template<class...> class L9, class... T9, 79 template<class...> class L10, class... T10, 80 template<class...> class L11, class... T11> 81 82 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...>> 83 { 84 using type = L1<T1..., T2..., T3..., T4..., T5..., T6..., T7..., T8..., T9..., T10..., T11...>; 85 }; 86 87 template< 88 89 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<>, 90 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<>, 91 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<>, 92 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<>, 93 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<>, 94 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<>, 95 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<>, 96 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<>, 97 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<>, 98 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<>, 99 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<> 100 101 > struct append_111_impl 102 { 103 using type = typename append_11_impl< 104 105 typename append_11_impl<L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, L0A>::type, 106 typename append_11_impl<mp_list<>, L10, L11, L12, L13, L14, L15, L16, L17, L18, L19>::type, 107 typename append_11_impl<mp_list<>, L20, L21, L22, L23, L24, L25, L26, L27, L28, L29>::type, 108 typename append_11_impl<mp_list<>, L30, L31, L32, L33, L34, L35, L36, L37, L38, L39>::type, 109 typename append_11_impl<mp_list<>, L40, L41, L42, L43, L44, L45, L46, L47, L48, L49>::type, 110 typename append_11_impl<mp_list<>, L50, L51, L52, L53, L54, L55, L56, L57, L58, L59>::type, 111 typename append_11_impl<mp_list<>, L60, L61, L62, L63, L64, L65, L66, L67, L68, L69>::type, 112 typename append_11_impl<mp_list<>, L70, L71, L72, L73, L74, L75, L76, L77, L78, L79>::type, 113 typename append_11_impl<mp_list<>, L80, L81, L82, L83, L84, L85, L86, L87, L88, L89>::type, 114 typename append_11_impl<mp_list<>, L90, L91, L92, L93, L94, L95, L96, L97, L98, L99>::type, 115 typename append_11_impl<mp_list<>, LA0, LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9>::type 116 117 >::type; 118 }; 119 120 template< 121 122 class L00, class L01, class L02, class L03, class L04, class L05, class L06, class L07, class L08, class L09, class L0A, 123 class L10, class L11, class L12, class L13, class L14, class L15, class L16, class L17, class L18, class L19, 124 class L20, class L21, class L22, class L23, class L24, class L25, class L26, class L27, class L28, class L29, 125 class L30, class L31, class L32, class L33, class L34, class L35, class L36, class L37, class L38, class L39, 126 class L40, class L41, class L42, class L43, class L44, class L45, class L46, class L47, class L48, class L49, 127 class L50, class L51, class L52, class L53, class L54, class L55, class L56, class L57, class L58, class L59, 128 class L60, class L61, class L62, class L63, class L64, class L65, class L66, class L67, class L68, class L69, 129 class L70, class L71, class L72, class L73, class L74, class L75, class L76, class L77, class L78, class L79, 130 class L80, class L81, class L82, class L83, class L84, class L85, class L86, class L87, class L88, class L89, 131 class L90, class L91, class L92, class L93, class L94, class L95, class L96, class L97, class L98, class L99, 132 class LA0, class LA1, class LA2, class LA3, class LA4, class LA5, class LA6, class LA7, class LA8, class LA9, 133 class... Lr 134 135 > struct append_inf_impl 136 { 137 using prefix = typename append_111_impl< 138 139 L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, L0A, 140 L10, L11, L12, L13, L14, L15, L16, L17, L18, L19, 141 L20, L21, L22, L23, L24, L25, L26, L27, L28, L29, 142 L30, L31, L32, L33, L34, L35, L36, L37, L38, L39, 143 L40, L41, L42, L43, L44, L45, L46, L47, L48, L49, 144 L50, L51, L52, L53, L54, L55, L56, L57, L58, L59, 145 L60, L61, L62, L63, L64, L65, L66, L67, L68, L69, 146 L70, L71, L72, L73, L74, L75, L76, L77, L78, L79, 147 L80, L81, L82, L83, L84, L85, L86, L87, L88, L89, 148 L90, L91, L92, L93, L94, L95, L96, L97, L98, L99, 149 LA0, LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9 150 151 >::type; 152 153 using type = typename mp_append_impl<prefix, Lr...>::type; 154 }; 155 156 #if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) 157 158 template<class... L> 159 struct mp_append_impl_cuda_workaround 160 { 161 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> > >; 162 }; 163 164 template<class... L> struct mp_append_impl: mp_append_impl_cuda_workaround<L...>::type::template fn<L...> 165 { 166 }; 167 168 #else 169 170 template<class... L> struct mp_append_impl: 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> > >::template fn<L...> 171 { 172 }; 173 174 #endif 175 176 #endif 177 178 } // namespace detail 179 180 template<class... L> using mp_append = typename detail::mp_append_impl<L...>::type; 181 182 } // namespace mp11 183 } // namespace boost 184 185 #endif // #ifndef BOOST_MP11_DETAIL_MP_APPEND_HPP_INCLUDED 186