Skip to content

Commit

Permalink
Renamed to_Array to to_array and to_Array_impl to to_array_impl
Browse files Browse the repository at this point in the history
  • Loading branch information
nliber committed May 24, 2024
1 parent 17358c6 commit e3b9316
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions core/src/Kokkos_Array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,27 +359,27 @@ Array(T, Us...)->Array<T, 1 + sizeof...(Us)>;
namespace Impl {

template <typename T, size_t N, size_t... I>
KOKKOS_FUNCTION constexpr Array<std::remove_cv_t<T>, N> to_Array_impl(
KOKKOS_FUNCTION constexpr Array<std::remove_cv_t<T>, N> to_array_impl(
T (&a)[N], std::index_sequence<I...>) {
return {{a[I]...}};
}

template <typename T, size_t N, size_t... I>
KOKKOS_FUNCTION constexpr Array<std::remove_cv_t<T>, N> to_Array_impl(
KOKKOS_FUNCTION constexpr Array<std::remove_cv_t<T>, N> to_array_impl(
T(&&a)[N], std::index_sequence<I...>) {
return {{std::move(a[I])...}};
}

} // namespace Impl

template <typename T, size_t N>
KOKKOS_FUNCTION constexpr auto to_Array(T (&a)[N]) {
return Impl::to_Array_impl(a, std::make_index_sequence<N>{});
KOKKOS_FUNCTION constexpr auto to_array(T (&a)[N]) {
return Impl::to_array_impl(a, std::make_index_sequence<N>{});
}

template <typename T, size_t N>
KOKKOS_FUNCTION constexpr auto to_Array(T(&&a)[N]) {
return Impl::to_Array_impl(std::move(a), std::make_index_sequence<N>{});
KOKKOS_FUNCTION constexpr auto to_array(T(&&a)[N]) {
return Impl::to_array_impl(std::move(a), std::make_index_sequence<N>{});
}

} // namespace Kokkos
Expand Down
6 changes: 3 additions & 3 deletions core/unit_test/TestArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,20 @@ static_assert(test_array_specialization_kokkos_swap());

constexpr bool test_to_array() {
// copies a string literal
[[maybe_unused]] auto a1 = Kokkos::to_Array("foo");
[[maybe_unused]] auto a1 = Kokkos::to_array("foo");
static_assert(a1.size() == 4);
maybe_unused(a1);

// deduces both element type and length
[[maybe_unused]] auto a2 = Kokkos::to_Array({0, 2, 1, 3});
[[maybe_unused]] auto a2 = Kokkos::to_array({0, 2, 1, 3});
static_assert(std::is_same_v<decltype(a2), Kokkos::Array<int, 4>>);
maybe_unused(a2);

// gcc8 doesn't support the implicit conversion
#if !defined(KOKKOS_COMPILER_GNU) || (KOKKOS_COMPILER_GNU >= 910)
// deduces length with element type specified
// implicit conversion happens
[[maybe_unused]] auto a3 = Kokkos::to_Array<long>({0, 1, 3});
[[maybe_unused]] auto a3 = Kokkos::to_array<long>({0, 1, 3});
static_assert(std::is_same_v<decltype(a3), Kokkos::Array<long, 3>>);
maybe_unused(a3);
#endif
Expand Down

0 comments on commit e3b9316

Please sign in to comment.