// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2015 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MOREMETA_H #define EIGEN_MOREMETA_H // IWYU pragma: private #include "../InternalHeaderCheck.h" namespace Eigen { namespace internal { template struct type_list { constexpr static int count = sizeof...(tt); }; template struct type_list { constexpr static int count = sizeof...(tt) + 1; typedef t first_type; }; template struct numeric_list { constexpr static std::size_t count = sizeof...(nn); }; template struct numeric_list { static constexpr std::size_t count = sizeof...(nn) + 1; static constexpr T first_value = n; }; #ifndef EIGEN_PARSED_BY_DOXYGEN /* numeric list constructors * * equivalencies: * constructor result * typename gen_numeric_list::type numeric_list * typename gen_numeric_list_reversed::type numeric_list * typename gen_numeric_list_swapped_pair::type numeric_list * typename gen_numeric_list_repeated::type numeric_list */ template struct gen_numeric_list : gen_numeric_list {}; template struct gen_numeric_list { typedef numeric_list type; }; template struct gen_numeric_list_reversed : gen_numeric_list_reversed {}; template struct gen_numeric_list_reversed { typedef numeric_list type; }; template struct gen_numeric_list_swapped_pair : gen_numeric_list_swapped_pair {}; template struct gen_numeric_list_swapped_pair { typedef numeric_list type; }; template struct gen_numeric_list_repeated : gen_numeric_list_repeated {}; template struct gen_numeric_list_repeated { typedef numeric_list type; }; /* list manipulation: concatenate */ template struct concat; template struct concat, type_list> { typedef type_list type; }; template struct concat, numeric_list> { typedef numeric_list type; }; template struct mconcat; template struct mconcat { typedef a type; }; template struct mconcat : concat {}; template struct mconcat : concat::type> {}; /* list manipulation: extract slices */ template struct take; template struct take> : concat, typename take>::type> {}; template struct take> { typedef type_list<> type; }; template struct take<0, type_list> { typedef type_list<> type; }; template <> struct take<0, type_list<>> { typedef type_list<> type; }; template struct take> : concat, typename take>::type> {}; // XXX The following breaks in gcc-11, and is invalid anyways. // template struct take> { typedef numeric_list type; // }; template struct take<0, numeric_list> { typedef numeric_list type; }; template struct take<0, numeric_list> { typedef numeric_list type; }; template struct h_skip_helper_numeric; template struct h_skip_helper_numeric : h_skip_helper_numeric {}; template struct h_skip_helper_numeric { typedef numeric_list type; }; template struct h_skip_helper_numeric { typedef numeric_list type; }; template struct h_skip_helper_numeric { typedef numeric_list type; }; template struct h_skip_helper_type; template struct h_skip_helper_type : h_skip_helper_type {}; template struct h_skip_helper_type<0, t, tt...> { typedef type_list type; }; template struct h_skip_helper_type { typedef type_list<> type; }; template <> struct h_skip_helper_type<0> { typedef type_list<> type; }; #endif // not EIGEN_PARSED_BY_DOXYGEN template struct h_skip { template constexpr static EIGEN_STRONG_INLINE typename h_skip_helper_numeric::type helper( numeric_list) { return typename h_skip_helper_numeric::type(); } template constexpr static EIGEN_STRONG_INLINE typename h_skip_helper_type::type helper(type_list) { return typename h_skip_helper_type::type(); } }; template struct skip { typedef decltype(h_skip::helper(a())) type; }; template struct slice : take::type> {}; /* list manipulation: retrieve single element from list */ template struct get; template struct get> : get> {}; template struct get<0, type_list> { typedef a type; }; template struct get> : get> {}; template struct get<0, numeric_list> { constexpr static T value = a; }; template constexpr T array_get(const numeric_list&) { return get<(int)n, numeric_list>::value; } /* always get type, regardless of dummy; good for parameter pack expansion */ template struct id_numeric { typedef t type; }; template struct id_type { typedef t type; }; /* equality checking, flagged version */ template struct is_same_gf : is_same { constexpr static int global_flags = 0; }; /* apply_op to list */ template class op, typename additional_param, typename... values> struct h_apply_op_helper { typedef type_list::type...> type; }; template