From 6abab491708dcfb361b6829960a6e79abb8945d6 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Wed, 21 Jun 2023 23:35:02 +0200 Subject: [PATCH] Update the type expected by View::operator[] Signed-off-by: Andrea Bocci --- include/alpaka/mem/view/ViewAccessOps.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/alpaka/mem/view/ViewAccessOps.hpp b/include/alpaka/mem/view/ViewAccessOps.hpp index 20701ea6834d..8c18c00b374d 100644 --- a/include/alpaka/mem/view/ViewAccessOps.hpp +++ b/include/alpaka/mem/view/ViewAccessOps.hpp @@ -22,6 +22,7 @@ namespace alpaka::internal using const_pointer = value_type const*; using reference = value_type&; using const_reference = value_type const&; + using Idx = alpaka::Idx; public: ViewAccessOps() @@ -63,13 +64,13 @@ namespace alpaka::internal return data(); } - ALPAKA_FN_HOST auto operator[](std::size_t i) -> reference + ALPAKA_FN_HOST auto operator[](Idx i) -> reference { static_assert(Dim::value == 1, "operator[i] is only valid for Buffers and Views of dimension 1"); return data()[i]; } - ALPAKA_FN_HOST auto operator[](std::size_t i) const -> const_reference + ALPAKA_FN_HOST auto operator[](Idx i) const -> const_reference { static_assert(Dim::value == 1, "operator[i] is only valid for Buffers and Views of dimension 1"); return data()[i]; @@ -79,7 +80,6 @@ namespace alpaka::internal template [[nodiscard]] ALPAKA_FN_HOST auto ptr_at([[maybe_unused]] Vec, TIdx> index) const -> const_pointer { - using Idx = alpaka::Idx; static_assert( Dim::value == TDim, "the index type must have the same dimensionality as the Buffer or View");