diff --git a/include/ddc/deepcopy.hpp b/include/ddc/deepcopy.hpp index 890d4ac85..d4e468d22 100644 --- a/include/ddc/deepcopy.hpp +++ b/include/ddc/deepcopy.hpp @@ -3,31 +3,29 @@ #pragma once #include -#include #include #include "ddc/chunk_span.hpp" -#include "ddc/for_each.hpp" namespace ddc { -/** Copy the content of a view into another - * @param[out] dst the view in which to copy - * @param[in] src the view from which to copy - * @return to - */ +/** Copy the content of a borrowed chunk into another + * @param[out] dst the borrowed chunk in which to copy + * @param[in] src the borrowed chunk from which to copy + * @return dst as a ChunkSpan +*/ template -inline ChunkDst const& deepcopy(ChunkDst&& dst, ChunkSrc&& src) noexcept +auto deepcopy(ChunkDst&& dst, ChunkSrc&& src) { - static_assert(is_chunk_v); - static_assert(is_chunk_v); + static_assert(is_borrowed_chunk_v); + static_assert(is_borrowed_chunk_v); static_assert( - std::is_assignable_v, + std::is_assignable_v, chunk_reference_t>, "Not assignable"); assert(dst.domain().extents() == src.domain().extents()); Kokkos::deep_copy(dst.allocation_kokkos_view(), src.allocation_kokkos_view()); - return dst; + return dst.span_view(); } } // namespace ddc