\hypertarget{_w_1_2_work_2_software_2_libraries_2utl_2include_2utl_2meta_2typelist_8h-example}{}\section{W\+:/\+Work/\+Software/\+Libraries/utl/include/utl/meta/typelist.\+h}
A class template that just holds a parameter pack.\+The idea came from M\+PL\textquotesingle{}s sequence concept \mbox{[}\mbox{\hyperlink{invoke.h_link1}{link1}} 1\mbox{]} and from N4115 \mbox{[}\mbox{\hyperlink{invoke.h_link2}{link2}} 2\mbox{]}. In addition to N4115\textquotesingle{}s name \char`\"{}packer\char`\"{} we just prefer a name which is object, not a subject. This way the name gives the feeling of a container and smells like Python.

In addition to tuple we lack members, so typelist could serve as an empty base class, and an object of the ultimate type could always be instantiated (even if the parameter typelist contains void or some type that lacks a default constructor).


\begin{DoxyCode}
\textcolor{keyword}{using} l1 = typelist<int, void*, double, void>;
l1 a \{\};
\end{DoxyCode}


boost\+::hana \mbox{[}\mbox{\hyperlink{typelist.h_link3}{link3}} 3\mbox{]} suggests a more powerful scheme were type invariant structures can be used for metaprograming also. This lib does not need (yet) this kind of power (we afraid the responsibility that comes along). So a simple python-\/like list with some extra vector-\/like element access functionalities and no iterators is good enough(for now).

\label{invoke.h_link1}%
\Hypertarget{invoke.h_link1}%
\mbox{[}1\mbox{]}\+: \href{https://www.boost.org/doc/}{\tt https\+://www.\+boost.\+org/doc/} \label{invoke.h_link2}%
\Hypertarget{invoke.h_link2}%
\mbox{[}2\mbox{]}\+: \href{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4115.html}{\tt http\+://www.\+open-\/std.\+org/jtc1/sc22/wg21/docs/papers/2014/n4115.\+html} \label{typelist.h_link3}%
\Hypertarget{typelist.h_link3}%
\mbox{[}3\mbox{]}\+: \href{https://github.com/boostorg/hana}{\tt https\+://github.\+com/boostorg/hana}


\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#ifndef \_\_utl\_meta\_typelist\_h\_\_}
\textcolor{preprocessor}{#define \_\_utl\_meta\_typelist\_h\_\_}

\textcolor{preprocessor}{#include <\mbox{\hyperlink{impl_8h}{utl/core/impl.h}}>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{integral_8h}{utl/meta/integral.h}}>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{detection_8h}{utl/meta/detection.h}}>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{meta_2invoke_8h}{utl/meta/invoke.h}}>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{sfinae_8h}{utl/meta/sfinae.h}}>}

\textcolor{keyword}{namespace }\mbox{\hyperlink{namespaceutl}{utl}} \{
\textcolor{keyword}{namespace }meta \{

   \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Ts>
   \textcolor{keyword}{struct }typelist \{
      \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1typelist_a7332ca3d7a7ec5b730e24a4dab743fa6}{type}} = typelist;   

      \textcolor{keyword}{static} constexpr \textcolor{keywordtype}{size\_t} \mbox{\hyperlink{structutl_1_1meta_1_1typelist_af898a273ef1135286de6cef169db9c2d}{size}}() noexcept \{
         \textcolor{keywordflow}{return} \textcolor{keyword}{sizeof}...(Ts);
      \}
      \textcolor{keyword}{static} constexpr \textcolor{keywordtype}{bool} \mbox{\hyperlink{structutl_1_1meta_1_1typelist_ac502a5ad1b830e75693c2e3c7a7b1cb8}{empty}}() noexcept \{
         \textcolor{keywordflow}{return} (\textcolor{keyword}{sizeof}...(Ts) == 0);
      \}
      \textcolor{comment}{// ======= times utility =======}
   \textcolor{keyword}{private}:
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... > \textcolor{keyword}{struct }cat\_ \{ \};
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... L1, \textcolor{keyword}{typename}... L2>
      \textcolor{keyword}{struct }cat\_<typelist<L1...>, typelist<L2...>> \{
         \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1typelist_a7332ca3d7a7ec5b730e24a4dab743fa6}{type}} = typelist<L1..., L2...>;
      \};

      \textcolor{keyword}{template} <\textcolor{keywordtype}{size\_t} N, \textcolor{keyword}{typename} ...T>
      \textcolor{keyword}{struct }times\_ \{
         \textcolor{comment}{//static\_assert( N >= 0, "Cannot make typelist of negative length" );}
         \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1typelist_a7332ca3d7a7ec5b730e24a4dab743fa6}{type}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
            cat\_<
               \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<times\_<N/2, T...>>,
               \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<times\_<N - N/2, T...>>
            >
         >;
      \};
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} ...T>
      \textcolor{keyword}{struct }times\_<1, T...> \{
         \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1typelist_a7332ca3d7a7ec5b730e24a4dab743fa6}{type}} = typelist<T...>;
      \};
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} ...T>
      \textcolor{keyword}{struct }times\_<0, T...> \{
         \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1typelist_a7332ca3d7a7ec5b730e24a4dab743fa6}{type}} = typelist<>;
      \};
   \textcolor{keyword}{public}:
      \textcolor{keyword}{template}<\textcolor{keywordtype}{size\_t} N>
      \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1typelist_ac444325211852c503605ec6c820f3eae}{times}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
         times\_<N, Ts...>
      >;
   \};

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a0edfc2c15e42531e53c0822264d220ec}{size}} = size\_<List::size()>;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a58c1744750d0df133034f60a95f87e19}{empty}} = bool\_<List::empty()>;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} T1, \textcolor{keyword}{typename} T2>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_aa6513d9d2a5db3ba3517efff33adc761}{pair}} = typelist<T1, T2>;



   \textcolor{keyword}{template} <\textcolor{keywordtype}{size\_t} N, \textcolor{keyword}{typename} ...Ts>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_af6ff0017ea5e914543527b7135930f47}{repeat\_c}} = \textcolor{keyword}{typename} typelist<Ts...>::template times<N>;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} N, \textcolor{keyword}{typename} ...Ts>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_aa013c45afb59b5c132a72be54ba145fb}{repeat}} = \mbox{\hyperlink{namespaceutl_1_1meta_af6ff0017ea5e914543527b7135930f47}{repeat\_c}}<N::type::value, Ts...>;

   \textcolor{keyword}{namespace }apply\_impl \{
       \textcolor{keyword}{template} <\textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} Seq>
       \textcolor{keyword}{struct }apply\_ \{ \};

       \textcolor{keyword}{template}<\textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} ...List>
       \textcolor{keyword}{struct }apply\_<Fn, typelist<List...>> \{
          \textcolor{keyword}{using} type = \mbox{\hyperlink{namespaceutl_1_1meta_a77630cd8adc01f7193f6cb834313d90f}{invoke}}<Fn, List...>;
       \};
       \textcolor{keyword}{template} <\textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} T, T... Is>
       \textcolor{keyword}{struct }apply\_<Fn, \mbox{\hyperlink{namespaceutl_1_1meta_abc3ba8590a6cdd451f64d6c5dcd8ff99}{integer\_sequence}}<T, Is...>> \{
          \textcolor{keyword}{using} type = invoke<Fn, integral\_<T, Is>...>;
       \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} Seq>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a3f684549221fac60bc8c7979cb4b98f4}{apply}} = apply\_impl::apply\_<Fn, Seq>;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} Seq>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ac2952cd4ed04938edc6de21ffe200e9b}{apply\_t}} = eval <apply<Fn, Seq>>;


   \textcolor{comment}{/*}
\textcolor{comment}{    * ========= element access ========}
\textcolor{comment}{    */}
   \textcolor{keyword}{namespace }at\_impl \{

      \textcolor{keyword}{template} <\textcolor{keyword}{typename} T> \textcolor{keyword}{struct }\_add\_pointer \{ \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1at__impl_1_1__add__pointer_a372a7a88f139a95fc12a4da82483d269}{type}} = T*; \};
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} T> \textcolor{keyword}{using}  \mbox{\hyperlink{namespaceutl_1_1meta_1_1at__impl_a1759f370bc952ff21077efca9fe0e0b4}{add\_pointer}} = eval < \_add\_pointer <T> >;

      \textcolor{keyword}{template} <\textcolor{keyword}{typename} ...>
      \textcolor{keyword}{struct }at\_head\_ \{ \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... voids>
      \textcolor{keyword}{struct }at\_head\_ <typelist<voids...>> \{
         \textcolor{comment}{// successful selection N voids, one T* and the rest}
         \textcolor{keyword}{template} <\textcolor{keyword}{typename} T> \textcolor{keyword}{static} constexpr T select(voids..., T*, ...);
         \textcolor{comment}{// selection on error}
         \textcolor{keyword}{static} constexpr nil\_ select (...);
      \};

      \textcolor{keyword}{template}<\textcolor{keyword}{typename} List, index\_t N>
      \textcolor{keyword}{struct }at\_ \{ \};

      \textcolor{keyword}{template}<\textcolor{keyword}{typename}... List, \mbox{\hyperlink{namespaceutl_a676c0acd539dd04048dcc7b4d698577e}{index\_t}} N>
      \textcolor{keyword}{struct }at\_<typelist<List...>, N> \{
         \textcolor{keyword}{using} head\_ = at\_head\_<typelist<void*>::times<N>>;    \textcolor{comment}{//< make at\_head\_<> with N void*}
         \textcolor{keyword}{using} type = decltype(
            head\_::select(\textcolor{keyword}{static\_cast<}add\_pointer<List>\textcolor{keyword}{>}(\textcolor{keyword}{nullptr})...)   \textcolor{comment}{//< pass all as List*...}
         );
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, index\_t N>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a6683b804a20d54817d61ce4663527084}{at\_c}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      at\_impl::at\_<List, N>
   >;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} N>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a67329ec425c857dcaf4cde9044674c90}{at}} = at\_c<List, N::type::value>;


   \textcolor{keyword}{namespace }front\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} L>
      \textcolor{keyword}{struct }front\_ \{ \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail>
      \textcolor{keyword}{struct }front\_<typelist<Head, Tail...>> \{
         \textcolor{keyword}{using} type = Head;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ace309fb2eff5c4a5a806b9393abea486}{front}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      front\_impl::front\_<List>
   >;

   \textcolor{keyword}{namespace }back\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
      \textcolor{keyword}{struct }back\_ \{ \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail>
      \textcolor{keyword}{struct }back\_<typelist<Head, Tail...>> \{
         \textcolor{keyword}{using} type = \mbox{\hyperlink{namespaceutl_1_1meta_a6683b804a20d54817d61ce4663527084}{at\_c}} <
            typelist<Head, Tail...>, \textcolor{keyword}{sizeof}...(Tail)
         >;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ad9ee55707fc633d53577b81a59136b7d}{back}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      back\_impl::back\_<List>
   >;
   \textcolor{comment}{/*}
\textcolor{comment}{    * ========= typelist operations =========}
\textcolor{comment}{    */}

   \textcolor{keyword}{namespace }cat\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Lists>
      \textcolor{keyword}{struct }cat\_ \{ \};

      \textcolor{keyword}{template} <>
      \textcolor{keyword}{struct }cat\_<> \{
         \textcolor{keyword}{using} type = typelist<>;
      \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... L1>
      \textcolor{keyword}{struct }cat\_<typelist<L1...>> \{
         \textcolor{keyword}{using} type = typelist<L1...>;
      \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... L1, \textcolor{keyword}{typename}... L2>
      \textcolor{keyword}{struct }cat\_<typelist<L1...>, typelist<L2...>> \{
         \textcolor{keyword}{using} type = typelist<L1..., L2...>;
      \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... L1, \textcolor{keyword}{typename}... L2, \textcolor{keyword}{typename}... Ln>
      \textcolor{keyword}{struct }cat\_<typelist<L1...>, typelist<L2...>, Ln...>
         : cat\_ <typelist<L1..., L2...>, Ln...> \{ \};

   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Lists>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a70d0910ace47f4e12e8fa0788679044a}{cat}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      cat\_impl::cat\_<Lists...>
   >;


   \textcolor{keyword}{namespace }fold\_impl \{
      \textcolor{comment}{// fold<<T1, T2, T3>, V, F> == F<F<F<V, T1>, T2>, T3>}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename}, \textcolor{keyword}{typename}, \textcolor{keyword}{typename}>
      \textcolor{keyword}{struct }fold\_ \{ \}; \textcolor{comment}{// ill formed}

      \textcolor{comment}{// recursive call}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail,
               \textcolor{keyword}{typename} V,
               \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }fold\_<typelist<Head, Tail...>, V, Fn> \{
         \textcolor{comment}{// recursive call of fold\_ by consuming typelist and invoking Fn}
         \textcolor{keyword}{using} type = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
            fold\_<
               typelist<Tail...>,
               invoke<Fn, V, Head>,
               Fn
            >
         >;
      \};
      \textcolor{comment}{// termination call}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} V0, \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }fold\_<typelist<>, V0, Fn> \{
         \textcolor{keyword}{using} type = V0;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} V, \textcolor{keyword}{typename} Fn>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a6108f39d28c924146eff4143a61af226}{fold}} = eval<fold\_impl::fold\_<List, V, Fn>>;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} V, \textcolor{keyword}{typename} Fn>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_aeb5cb48e804cd160b39f8c3ed2967c37}{accumulate}} = fold<List, V, Fn>;

   \textcolor{keyword}{namespace }rev\_fold\_impl \{

      \textcolor{comment}{// rev\_fold<<T1, T2, T3>, V, F> == F<T1, F<T2, F<T3, V>>>}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename}, \textcolor{keyword}{typename}, \textcolor{keyword}{typename}>
      \textcolor{keyword}{struct }rev\_fold\_ \{ \}; \textcolor{comment}{// ill formed}

      \textcolor{comment}{// recursive call}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail,
               \textcolor{keyword}{typename} V,
               \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }rev\_fold\_<typelist<Head, Tail...>, V, Fn> \{
         \textcolor{comment}{// recursive call inside invoke. This way the 2nd argument of Fn}
         \textcolor{comment}{// becoming the recursive "thing", inside Fn<>}
         \textcolor{keyword}{using} type = \mbox{\hyperlink{namespaceutl_1_1meta_a77630cd8adc01f7193f6cb834313d90f}{invoke}} <
            Fn, Head, \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
               rev\_fold\_ <
                  typelist<Tail...>,
                  V,
                  Fn
               >>
         >;
      \};
      \textcolor{comment}{// pre-termination call}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Tail, \textcolor{keyword}{typename} V, \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }rev\_fold\_ <typelist<Tail>, V, Fn> \{
         \textcolor{keyword}{using} type = invoke<Fn, Tail, V>;
      \};
      \textcolor{comment}{// termination call}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} V, \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }rev\_fold\_ <typelist<>, V, Fn> \{
         \textcolor{keyword}{using} type = V;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} V, \textcolor{keyword}{typename} Fn>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ab1a91edef4cf9fd56b73c9a03eaeb3d4}{rev\_fold}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      rev\_fold\_impl::rev\_fold\_<List, V, Fn>
   >;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename}... Ts>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ab0f84ba0807b6fd36fa9e4e5cfc4cd32}{push\_front}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      \mbox{\hyperlink{namespaceutl_1_1meta_a3f684549221fac60bc8c7979cb4b98f4}{apply}} <
         bind\_front<quote<typelist>, Ts...>, List
      >
   >;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename}... Ts>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_adf545ba110edc6a34ddcaf2280a0c7f4}{push\_back}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      \mbox{\hyperlink{namespaceutl_1_1meta_a3f684549221fac60bc8c7979cb4b98f4}{apply}} <
         bind\_back<quote<typelist>, Ts...>, List
      >
   >;

   \textcolor{keyword}{namespace }reverse\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} V = typelist<>>
      \textcolor{keyword}{struct }reverse\_ \{
         \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1reverse__impl_1_1reverse___ad1618828ac681258d9909839df60dd39}{type}} = fold<List, V, quote<push\_front>>;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a2ae6bfa22f1912b0ba09d24e0ae2ccd9}{reverse}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      reverse\_impl::reverse\_<List>
   >;

   \textcolor{keyword}{namespace }pop\_front\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
      \textcolor{keyword}{struct }pop\_front\_ \{ \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail>
      \textcolor{keyword}{struct }pop\_front\_<typelist <Head, Tail...>> \{
         \textcolor{keyword}{using} type = typelist<Tail...>;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_aa4a307a81c0640c6c0dd08f8a53f3c32}{pop\_front}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      pop\_front\_impl::pop\_front\_<List>
   >;

   \textcolor{keyword}{namespace }pop\_back\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
      \textcolor{keyword}{struct }pop\_back\_ \{
         \textcolor{keyword}{using} \mbox{\hyperlink{structutl_1_1meta_1_1pop__back__impl_1_1pop__back___a8b82ff5dcd6fcda89b36f8e587e64d24}{type}} = \mbox{\hyperlink{namespaceutl_1_1meta_a2ae6bfa22f1912b0ba09d24e0ae2ccd9}{reverse}}<
            pop\_front<reverse<List>>
         >;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a86a37f5803c474823963e1f3c6f7a6d6}{pop\_back}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}} <
      pop\_back\_impl::pop\_back\_<List>
   >;

   \textcolor{keyword}{namespace }transform\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}, \textcolor{keyword}{typename} = \textcolor{keywordtype}{void}>
      \textcolor{keyword}{struct }transform\_ \{ \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Ts, \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }transform\_<typelist<typelist<Ts...>, Fn>,
                        \mbox{\hyperlink{group__detection_gae7373c997420d16cf37e542eb3cfa3ad}{void\_t}}<\mbox{\hyperlink{namespaceutl_1_1meta_a77630cd8adc01f7193f6cb834313d90f}{invoke}}<Fn, Ts>...> > \textcolor{comment}{/* SFINAE check */} \{
         \textcolor{keyword}{using} type = typelist<
            invoke\_t<Fn, Ts>...
         >;
      \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Ts0, \textcolor{keyword}{typename}... Ts1, \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }transform\_<typelist<typelist<Ts0...>, typelist<Ts1...>, Fn>,
                        \mbox{\hyperlink{group__detection_gae7373c997420d16cf37e542eb3cfa3ad}{void\_t}}<\mbox{\hyperlink{namespaceutl_1_1meta_a77630cd8adc01f7193f6cb834313d90f}{invoke}}<Fn, Ts0, Ts1>...>> \textcolor{comment}{/* SFINAE check */} \{
         \textcolor{keyword}{using} type = typelist<
            invoke\_t<Fn, Ts0, Ts1>...
         >;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Args>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ac8bbf187eea3cb5da38d1bdc97b52334}{transform}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      transform\_impl::transform\_<typelist<Args...>>
   >;

   \textcolor{keyword}{namespace }transform\_lazy\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}, \textcolor{keyword}{typename} = \textcolor{keywordtype}{void}>
      \textcolor{keyword}{struct }transform\_lazy\_ \{ \};

      \textcolor{comment}{// Match for Unary Fn with one typelist}
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Ts, \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }transform\_lazy\_<typelist<typelist<Ts...>, Fn>,
                             \mbox{\hyperlink{group__detection_gae7373c997420d16cf37e542eb3cfa3ad}{void\_t}}<\mbox{\hyperlink{namespaceutl_1_1meta_a77630cd8adc01f7193f6cb834313d90f}{invoke}}<Fn, Ts>...> > \textcolor{comment}{/* SFINAE check */} \{
         \textcolor{keyword}{using} type = typelist<
            invoke<Fn, Ts>...
         >;
      \};

      \textcolor{comment}{// Match for Binary Fn with two typelists}
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Ts0, \textcolor{keyword}{typename}... Ts1, \textcolor{keyword}{typename} Fn>
      \textcolor{keyword}{struct }transform\_lazy\_<typelist<typelist<Ts0...>, typelist<Ts1...>, Fn>,
                             \mbox{\hyperlink{group__detection_gae7373c997420d16cf37e542eb3cfa3ad}{void\_t}}<\mbox{\hyperlink{namespaceutl_1_1meta_a77630cd8adc01f7193f6cb834313d90f}{invoke}}<Fn, Ts0, Ts1>...>> \textcolor{comment}{/* SFINAE check */} \{
         \textcolor{keyword}{using} type = typelist<
            invoke<Fn, Ts0, Ts1>...
         >;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Args>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a55c0405bfb94c1d285d3131390c31451}{transform\_lazy}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      transform\_lazy\_impl::transform\_lazy\_<typelist<Args...>>
   >;


   \textcolor{keyword}{namespace }find\_if\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}, \textcolor{keyword}{typename}, index\_t>
      \textcolor{keyword}{struct }find\_if\_ \{ \};

      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail, \textcolor{keyword}{typename} Fn, \mbox{\hyperlink{namespaceutl_a676c0acd539dd04048dcc7b4d698577e}{index\_t}} N>
      \textcolor{keyword}{struct }find\_if\_<typelist<Head, Tail...>, Fn, N> \{
         \textcolor{comment}{// Recursive call to find\_if\_ until Fn returns true\_}
         \textcolor{keyword}{using} type = \mbox{\hyperlink{group__type_ga39cc4e727a8faa5ea176f543e62c05c0}{if\_}} <
            invoke\_t<Fn, Head>,
            index\_<N>,       \textcolor{comment}{// done, return current index}
            \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<find\_if\_<   \textcolor{comment}{// not done, re-call find\_if\_ with the Tail...}
               typelist<Tail...>, Fn, N+1>
            >
         >;
      \};

      \textcolor{comment}{// When empty or when we are one place after the last item return Npos}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Fn, index\_t N>
      \textcolor{keyword}{struct }find\_if\_<typelist<>, Fn, N> \{
         \textcolor{keyword}{using} type = \mbox{\hyperlink{namespaceutl_1_1meta_af0c85cc6480a9e7a8e4fb7d8f936f01b}{Npos}};
      \};
   \}

   \textcolor{keyword}{template}<\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} Pred>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_aacf124929c0cbb3b29d34679bff50a96}{find\_if}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      find\_if\_impl::find\_if\_<List, Pred, 0>
   >;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} T>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_af4c9b6350bba98cc0dd73e87cb4ce413}{find}} = find\_if<List, same\_as<T>>;

   \textcolor{keyword}{namespace }seek\_if\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}, \textcolor{keyword}{typename}, index\_t>
      \textcolor{keyword}{struct }seek\_if\_ \{ \};

      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail, \textcolor{keyword}{typename} Fn, \mbox{\hyperlink{namespaceutl_a676c0acd539dd04048dcc7b4d698577e}{index\_t}} N>
      \textcolor{keyword}{struct }seek\_if\_<typelist<Head, Tail...>, Fn, N> \{
         \textcolor{comment}{// recursive call to seek\_if\_ until Fn returns true\_}
         \textcolor{keyword}{using} type = \mbox{\hyperlink{group__type_ga39cc4e727a8faa5ea176f543e62c05c0}{if\_}} <
            invoke\_t<Fn, Head>,
            typelist<Head, Tail...>,   \textcolor{comment}{// done, return the typelist starting from here}
            \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<seek\_if\_<             \textcolor{comment}{// not done, re-call seek\_if\_ with the Tail...}
               typelist<Tail...>, Fn, N+1>
            >
         >;
      \};

      \textcolor{comment}{// When empty or when we are one place after the last item return empty typelist}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Fn, index\_t N>
      \textcolor{keyword}{struct }seek\_if\_<typelist<>, Fn, N> \{
         \textcolor{keyword}{using} type = typelist<>;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} Pred>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ab8eafd75f3077a36c4e3363b742da64a}{seek\_if}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      seek\_if\_impl::seek\_if\_<List, Pred, 0>
   >;
   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} T>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_aa550d9dc96d34623af4ce71f8a1eaff5}{seek}} = seek\_if <List, same\_as<T>>;

   \textcolor{keyword}{namespace }count\_if\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}, \textcolor{keyword}{typename}, \textcolor{keywordtype}{size\_t}>
      \textcolor{keyword}{struct }count\_if\_ \{ \};

      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail, \textcolor{keyword}{typename} Fn, \textcolor{keywordtype}{size\_t} N>
      \textcolor{keyword}{struct }count\_if\_<typelist<Head, Tail...>, Fn, N> \{
         \textcolor{comment}{// Recursive call to count\_if\_ up to the end of List, counting all invokes of Fn}
         \textcolor{comment}{// returning true\_}
         \textcolor{keyword}{using} type = \mbox{\hyperlink{group__type_ga39cc4e727a8faa5ea176f543e62c05c0}{if\_}} <
            invoke\_t<Fn, Head>,
            \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
               count\_if\_<typelist<Tail...>, Fn, N+1>  \textcolor{comment}{// increase and re-call}
            >,
            \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
               count\_if\_<typelist<Tail...>, Fn, N>    \textcolor{comment}{// re-call without increasing}
            >
         >;
      \};

      \textcolor{comment}{// At the end of the List return the counter}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Fn, \textcolor{keywordtype}{size\_t} N>
      \textcolor{keyword}{struct }count\_if\_<typelist<>, Fn, N> \{
         \textcolor{keyword}{using} type = size\_<N>;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} Pred>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a981e18b40d69cdd76466de7bfe24e619}{count\_if}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      count\_if\_impl::count\_if\_<List, Pred, 0>
   >;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} T>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ab5508236016638fa8e6b97cd17dfc9c2}{count}} = count\_if<List, same\_as<T>>;

   \textcolor{keyword}{namespace }filter\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}, \textcolor{keyword}{typename}, \textcolor{keyword}{typename}>
      \textcolor{keyword}{struct }filter\_ \{ \};

      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail, \textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} L>
      \textcolor{keyword}{struct }filter\_<typelist<Head, Tail...>, Fn, L> \{
         \textcolor{comment}{// Recursive call to filter\_ up to the end of the List, creating a new list}
         \textcolor{comment}{// of items for which the invoke of Fn returns true\_}
         \textcolor{keyword}{using} type = \mbox{\hyperlink{group__type_ga39cc4e727a8faa5ea176f543e62c05c0}{if\_}} <
            invoke\_t <Fn, Head>,
            \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<filter\_<typelist<Tail...>, Fn, cat<L, typelist<Head>>>>, \textcolor{comment}{// Add the element and
       re-call}
            \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<filter\_<typelist<Tail...>, Fn, L>>  \textcolor{comment}{// re-call with the same list}
         >;
      \};

      \textcolor{comment}{// At the end return the produced list}
      \textcolor{keyword}{template}<\textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} L>
      \textcolor{keyword}{struct }filter\_<typelist<>, Fn, L> \{
         \textcolor{keyword}{using} type = L;
      \};
   \}

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} Pred>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ac72acc616316c322e750d20a46553ba4}{filter}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      filter\_impl::filter\_<List, Pred, typelist<>>
   >;

   \textcolor{keyword}{namespace }replace\_if\_impl \{
      \textcolor{keyword}{template} <\textcolor{keyword}{typename}, \textcolor{keyword}{typename}, \textcolor{keyword}{typename}, \textcolor{keyword}{typename}>
      \textcolor{keyword}{struct }replace\_if\_ \{ \};

      \textcolor{keyword}{template} <\textcolor{keyword}{typename} Head, \textcolor{keyword}{typename}... Tail, \textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} T, \textcolor{keyword}{typename} Ret>
      \textcolor{keyword}{struct }replace\_if\_<typelist<Head, Tail...>, Fn, T, Ret> \{
         \textcolor{comment}{// Recursive call to replace\_if\_ up to the end of the List, creating a new list}
         \textcolor{comment}{// of items based on invocation of Fn}
         \textcolor{keyword}{using} type = \mbox{\hyperlink{group__type_ga39cc4e727a8faa5ea176f543e62c05c0}{if\_}} <
            invoke\_t<Fn, Head>,
            \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<replace\_if\_<typelist<Tail...>, Fn, T, cat<Ret, typelist<T>>>>,    \textcolor{comment}{// re-call with
       change to T}
            \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<replace\_if\_<typelist<Tail...>, Fn, T, cat<Ret, typelist<Head>>>>  \textcolor{comment}{// re-call with no
       change}
         >;
      \};

      \textcolor{comment}{// At the end return the produced list}
      \textcolor{keyword}{template} <\textcolor{keyword}{typename} Fn, \textcolor{keyword}{typename} T, \textcolor{keyword}{typename} Ret>
      \textcolor{keyword}{struct }replace\_if\_ <typelist<>, Fn, T, Ret> \{
         \textcolor{keyword}{using} type = Ret;
      \};
   \}

   \textcolor{keyword}{template}<\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} Pred, \textcolor{keyword}{typename} T>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a848a47bf281bf3eaf932cc9113477102}{replace\_if}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}}<
      replace\_if\_impl::replace\_if\_<List, Pred, T, typelist<>>
   >;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} T, \textcolor{keyword}{typename} U>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ac9d120f858ebfa2b0ef74c6305a9fb6d}{replace}} = \mbox{\hyperlink{namespaceutl_1_1meta_aa5a37adba244ff4286f994111c4c02ea}{eval}} <
      replace\_if <List, same\_as<T>, U>
   >;


   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} Pred>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_ace96e2f19376375cc71ee0cd80f4bb75}{all\_of}} = \mbox{\hyperlink{group__type_ga39cc4e727a8faa5ea176f543e62c05c0}{if\_}} <
      empty <List>,
      \mbox{\hyperlink{namespaceutl_1_1meta_a55511dbaa0adb605ce22dcec11f8d22d}{false\_}},
      \mbox{\hyperlink{namespaceutl_1_1meta_a58c1744750d0df133034f60a95f87e19}{empty}} <
         filter <List, compose<quote<not\_>, Pred>>
      >
   >;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} Pred>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_a212c26a29491610187f6e8543f06df5f}{any\_of}} = \mbox{\hyperlink{group__integral_ga16df145331d3c62e624385c5949d90c4}{not\_}}<
      empty<filter <List, Pred>>
   >;

   \textcolor{keyword}{template} <\textcolor{keyword}{typename} List, \textcolor{keyword}{typename} Pred>
   \textcolor{keyword}{using} \mbox{\hyperlink{namespaceutl_1_1meta_af324255cfaa0be3f02843961f5becb85}{none\_of}} = \mbox{\hyperlink{namespaceutl_1_1meta_a58c1744750d0df133034f60a95f87e19}{empty}}<
      filter <List, Pred>
   >;

\}\}


\textcolor{preprocessor}{#endif }\textcolor{comment}{/* \_\_utl\_meta\_typelist\_h\_\_ */}\textcolor{preprocessor}{}
\end{DoxyCodeInclude}
 