Commit 000546f7 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Tomáš Oberhuber
Browse files

Added a method ArrayView::copy for shallow copy.

parent 57de3baa
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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.
    *
+13 −0
Original line number Diff line number Diff line
@@ -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 >