29 #include <ableton/build_system/Warnings.hpp>
31 #include <boost/mpl/sequence_tag.hpp>
32 #include <boost/mpl/pop_front_fwd.hpp>
33 #include <boost/mpl/push_front_fwd.hpp>
34 #include <boost/mpl/push_back_fwd.hpp>
35 #include <boost/mpl/front_fwd.hpp>
36 #include <boost/mpl/empty_fwd.hpp>
37 #include <boost/mpl/size_fwd.hpp>
38 #include <boost/mpl/at_fwd.hpp>
39 #include <boost/mpl/back_fwd.hpp>
40 #include <boost/mpl/clear_fwd.hpp>
41 #include <boost/mpl/pop_back_fwd.hpp>
42 #include <boost/mpl/iterator_tags.hpp>
43 #include <boost/mpl/next_prior.hpp>
44 #include <boost/mpl/deref.hpp>
45 #include <boost/mpl/begin_end_fwd.hpp>
47 #include <type_traits>
56 template <
typename ...Ts>
64 template <
typename... Ts1,
typename... Ts2>
67 return std::is_same<
pack<Ts1...>,
pack<Ts2...> >{};
73 template <
typename... Ts1,
typename... Ts2>
76 return !std::is_same<
pack<Ts1...>,
pack<Ts2...> >{};
81 template <
template<
typename...>
class MF,
typename ArgT>
84 using type = MF<ArgT>;
87 template <
template<
typename...>
class MF,
typename... ArgTs>
88 struct unpack<MF, meta::pack<ArgTs...> >
90 using type = MF<ArgTs...>;
100 template <
template<
typename...>
class MF,
typename T>
101 using unpack =
typename detail::unpack<MF, T>::type;
103 template <
template<
typename...>
class MF,
typename T>
108 template <
class ... Args>
111 template <
class ... Args>
114 typedef atria::meta::pack_tag tag;
115 typedef boost::mpl::forward_iterator_tag category;
124 template <
class ... Args>
125 struct sequence_tag<
atria::meta::pack<Args...>>
127 typedef atria::meta::pack_tag type;
131 struct front_impl<
atria::meta::pack_tag>
133 template <
typename PackT>
struct apply;
134 template <
typename T,
typename ...Ts>
135 struct apply<
atria::meta::pack<T, Ts...>>
142 struct empty_impl<
atria::meta::pack_tag>
144 template <
typename PackT>
struct apply;
145 template <
typename ...Ts>
146 struct apply<
atria::meta::pack<Ts...>>
147 : std::integral_constant<bool, sizeof...(Ts) == 0>
152 struct pop_front_impl<
atria::meta::pack_tag>
154 template <
typename PackT>
struct apply;
155 template <
class First,
class ...Types>
156 struct apply<
atria::meta::pack<First, Types...>>
163 struct push_front_impl<
atria::meta::pack_tag>
165 template <
typename PackT,
typename T>
struct apply;
166 template <
typename T,
typename ... Args>
167 struct apply<
atria::meta::pack<Args...>, T>
174 struct push_back_impl<
atria::meta::pack_tag>
176 template <
typename PackT,
typename T>
struct apply;
177 template <
typename T,
typename ... Args >
178 struct apply<
atria::meta::pack<Args...>, T>
185 struct size_impl<
atria::meta::pack_tag>
187 template <
typename PackT>
struct apply;
188 template <
typename ...Ts>
189 struct apply<
atria::meta::pack<Ts...>>
190 : std::integral_constant<std::size_t, sizeof...(Ts)>
195 struct at_impl<
atria::meta::pack_tag>
197 template <
typename T>
200 static_assert(std::is_same<T, T>::value,
"not implemented");
205 struct back_impl<
atria::meta::pack_tag>
207 template <
typename T>
210 static_assert(std::is_same<T, T>::value,
"not implemented");
215 struct clear_impl<
atria::meta::pack_tag>
217 template <
typename PackT>
225 struct pop_back_impl<
atria::meta::pack_tag>
227 template <
typename T>
230 static_assert(std::is_same<T, T>::value,
"not implemented");
235 struct begin_impl<
atria::meta::pack_tag>
237 template <
class PackT>
struct apply
244 struct end_impl<
atria::meta::pack_tag>
246 template <
typename>
struct apply
253 template <
typename First,
class ... Args>
254 struct deref<
atria::meta::pack_iterator<
255 atria::meta::pack<First, Args...>>>
260 template <
typename First,
class ... Args>
261 struct next<
atria::meta::pack_iterator<
262 atria::meta::pack<First, Args...>>>
C++ amazing templates and reusable implementations awesomeness.