//===----------------------------------------------------------------------===// // // Part of the libcu++ Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // metafunction header that provides some vocabulary for manipulating type packs // exports: // rotl // for_n // bind_last, B> // append // append_n #ifndef HETEROGENEOUS_META_H #define HETEROGENEOUS_META_H template struct type_list {}; // Rotates the typelist by removing the head and moving it to the tail template struct rotl_impl { // Empty or 1 element case using type = type_list; }; template struct rotl_impl { using type = type_list; }; template struct rotl_impl> { using type = typename rotl_impl::type; }; template using rotl = typename rotl_impl::type; // static_assert(std::is_same, type_list>(), ""); // static_assert(std::is_same, type_list>(), ""); template class Fn> struct for_n_impl { using type = typename for_n_impl, Fn>::type; }; template class Fn> struct for_n_impl<1, T, Fn> { using type = Fn; }; template class Fn> struct for_n_impl<0, T, Fn> { using type = T; }; template class Fn> using for_n = typename for_n_impl::type; // static_assert(std::is_same, rotl>, type_list>(), ""); // static_assert(std::is_same, rotl>, type_list>(), ""); template