#pragma once /* Copyright (c) 2017 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. */ namespace meta::detail { template struct tuple; template struct reverse_; template class x, typename... ys> struct reverse_, x> { using type = typename reverse_, x>::type; }; template class x, typename... ys> struct reverse_, x> { using type = x; }; template class, typename, typename...> struct lift_; template class to, template class from, typename... xs> struct lift_> { using type = to; }; template struct append_helper; template struct cons_; template class t, typename x, typename... xs> struct cons_> { using type = t; }; template struct append2; template class t, typename... xs> struct append2> { template struct append1; template class u, typename... ys> struct append1> { using type = t; }; }; template struct list__; template struct list__ { template struct list1; template class t, typename... xs> struct list1> { using type = t; }; using type = typename list1::type; }; template struct append_ { using t1 = append2; using type = typename t1::template append1::type; }; } // ns meta::detail namespace meta { template using tuple_ = detail::tuple; template using reverse = typename detail::reverse_, detail::tuple<>>::type; // the to/from order is awkward but mimics function composition template class to, typename from> using lift = typename detail::lift_::type; template using first = x; template using rest = detail::tuple; template using butlast = reverse>>; template using last = lift>; template using cons = typename detail::cons_::type; template using append = typename detail::append_; template using list_ = typename detail::list__; } // ns meta