diff --git a/CMakeLists.txt b/CMakeLists.txt index 19c9c7b..8e7e455 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,7 @@ target_sources( include/kokkos-utils/concepts/Space.hpp include/kokkos-utils/concepts/View.hpp + include/kokkos-utils/impl/type_list.hpp include/kokkos-utils/impl/type_traits.hpp include/kokkos-utils/view/extents.hpp diff --git a/include/kokkos-utils/impl/type_list.hpp b/include/kokkos-utils/impl/type_list.hpp new file mode 100644 index 0000000..8ba4aef --- /dev/null +++ b/include/kokkos-utils/impl/type_list.hpp @@ -0,0 +1,78 @@ +#ifndef KOKKOS_UTILS_IMPL_TYPE_LIST_HPP +#define KOKKOS_UTILS_IMPL_TYPE_LIST_HPP + +#include "impl/Kokkos_Utilities.hpp" + +/** + * @file + * + * This file provides extensions to the @c Kokkos::Impl::type_list struct in @c Kokkos_Utilities.hpp. + */ + +namespace Kokkos::utils::impl +{ + +//! @name Get the number of types in a @c Kokkos::Impl::type_list. +///@{ +template +struct TypeListSize; + +template +struct TypeListSize> : std::integral_constant {}; + +template +inline constexpr size_t type_list_size_v = TypeListSize::value; +///@} + +//! @name Get the @p I th type in a @c Kokkos::Impl::type_list. +///@{ +template +struct TypeListAt; + +template +struct TypeListAt> + : TypeListAt> {}; + +template +struct TypeListAt<0, Kokkos::Impl::type_list> +{ + using type = Head; +}; + +template +using type_list_at_t = typename TypeListAt::type; +///@} + +//! @name Transform a @c Kokkos::Impl::type_list. +///@{ +template