Commit dbc325ab authored by Jakub Klinkovský's avatar Jakub Klinkovský Committed by Tomáš Oberhuber
Browse files

Simplified comparison operators in ArrayView

parent 2781e3e8
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
@@ -374,19 +374,6 @@ public:
   __cuda_callable__
   const Value& operator[]( Index i ) const;

   /**
    * \brief Comparison operator with another array view \e view.
    *
    * \tparam Value_ is the value type of the right-hand-side array view.
    * \tparam Device_ is the device type of the right-hand-side array view.
    * \tparam Index_ is the index type of the right-hand-side array view.
    * \param  view is reference to the right-hand-side array view.
    *
    * \return True if both array views are equal element-wise and false otherwise.
    */
   template< typename Value_, typename Device_, typename Index_ >
   bool operator==( const ArrayView< Value_, Device_, Index_ >& view ) const;

   /**
    * \brief Comparison operator with another array-like container \e array.
    *
@@ -398,19 +385,6 @@ public:
   template< typename ArrayT >
   bool operator==( const ArrayT& array ) const;

   /**
    * \brief Comparison negation operator with another array view \e view.
    *
    * \tparam Value_ is the value type of the right-hand-side array view.
    * \tparam Device_ is the device type of the right-hand-side array view.
    * \tparam Index_ is the index type of the right-hand-side array view.
    * \param  view is reference to the right-hand-side array view.
    *
    * \return True if both array views are not equal element-wise and false otherwise.
    */
   template< typename Value_, typename Device_, typename Index_ >
   bool operator!=( const ArrayView< Value_, Device_, Index_ >& view ) const;

   /**
    * \brief Comparison negation operator with another array-like container \e array.
    *
+2 −28
Original line number Diff line number Diff line
@@ -279,24 +279,9 @@ operator[]( Index i ) const
template< typename Value,
          typename Device,
          typename Index >
   template< typename Value_, typename Device_, typename Index_ >
bool
ArrayView< Value, Device, Index >::
operator==( const ArrayView< Value_, Device_, Index_ >& view ) const
{
   if( view.getSize() != getSize() )
      return false;
   if( getSize() == 0 )
      return true;
   return Algorithms::ArrayOperations< Device, Device_ >::compareMemory( getData(), view.getData(), getSize() );
}

template< typename Value_,
          typename Device_,
          typename Index_ >
   template< typename ArrayT >
bool
ArrayView< Value_, Device_, Index_ >::
ArrayView< Value, Device, Index >::
operator==( const ArrayT& array ) const
{
   if( array.getSize() != this->getSize() )
@@ -312,20 +297,9 @@ operator==( const ArrayT& array ) const
template< typename Value,
          typename Device,
          typename Index >
   template< typename Value_, typename Device_, typename Index_ >
bool
ArrayView< Value, Device, Index >::
operator!=( const ArrayView< Value_, Device_, Index_ >& view ) const
{
   return ! ( *this == view );
}

template< typename Value_,
          typename Device_,
          typename Index_ >
   template< typename ArrayT >
bool
ArrayView< Value_, Device_, Index_ >::
ArrayView< Value, Device, Index >::
operator!=( const ArrayT& array ) const
{
   return ! ( *this == array );