diff --git a/src/TNL/Containers/ArrayView.h b/src/TNL/Containers/ArrayView.h index c06ad56dcc113541167b9d012ca4caf836a4f5c5..b4e063b7e9b462a6372647b49e87a2f0d3264e9f 100644 --- a/src/TNL/Containers/ArrayView.h +++ b/src/TNL/Containers/ArrayView.h @@ -237,6 +237,15 @@ public: typename = std::enable_if_t< std::is_convertible< T, ValueType >::value || IsArrayType< T >::value > > ArrayView& operator=( const T& array ); + /** + * \brief Shallow copy of the array view + * + * \param view Reference to the source array view. + * \return Reference to this array view. + */ + __cuda_callable__ + ArrayView& copy( const ArrayView& view ); + /** * \brief Swaps this array view with another. * diff --git a/src/TNL/Containers/ArrayView.hpp b/src/TNL/Containers/ArrayView.hpp index c3c39bc10be8dd846331d1086fc1d22b42b8c6c7..4ef8ac3f6ea6f5710cac5f6b1b3e70c10b040bec 100644 --- a/src/TNL/Containers/ArrayView.hpp +++ b/src/TNL/Containers/ArrayView.hpp @@ -118,6 +118,19 @@ operator=( const T& data ) return *this; } +template< typename Value, + typename Device, + typename Index > +__cuda_callable__ +ArrayView< Value, Device, Index >& +ArrayView< Value, Device, Index >:: +copy( const ArrayView& view ) +{ + data = view.data; + size = view.size; + return *this; +} + template< typename Value, typename Device, typename Index >