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

[WIP] Debugging array assignment.

parent 4b84bb3a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -28,10 +28,10 @@ private:
    typedef char NoType[2];

    template< typename C > static YesType& test( decltype(&C::getArrayData) );
    template< typename C > static NoType& test(...);
    //template< typename C > static NoType& test(...);

public:
    enum { value = sizeof( test< T >(0) ) == sizeof( YesType ) };
    static constexpr bool value = ( sizeof( test< T >(0) ) == sizeof( YesType ) );
};
} // namespace Details

@@ -58,7 +58,7 @@ struct ArrayAssignment< Array, T, true >

/**
 * \brief Specialization for array-value assignment for other types. We assume
 * thet T is convertible to Array::ValueType.
 * that T is convertible to Array::ValueType.
 */
template< typename Array,
          typename T >
+1 −1
Original line number Diff line number Diff line
@@ -492,7 +492,7 @@ class Array : public Object
      /**
       * \brief Returns true if non-zero size is set.
       */
      operator bool() const;
      //operator bool() const;

      /**
       * \brief Method for saving the object to a \e file as a binary data.
+4 −4
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ Array( Value* data,
{
}

/*template< typename Value,
template< typename Value,
          typename Device,
          typename Index >
Array< Value, Device, Index >::
@@ -76,7 +76,7 @@ Array( const Array< Value, Device, Index >& array )
   // Deep copy does not work because of EllpackIndexMultiMap - TODO: Fix it
   this->setSize( array.getSize() );
   Algorithms::ArrayOperations< Device >::copyMemory( this->getData(), array.getData(), array.getSize() );
}*/
}

template< typename Value,
          typename Device,
@@ -636,13 +636,13 @@ containsOnlyValue( const Value& v,
   return Algorithms::ArrayOperations< Device >::containsOnlyValue( &this->getData()[ begin ], end - begin, v );
}

template< typename Value,
/*template< typename Value,
          typename Device,
          typename Index >
Array< Value, Device, Index >::operator bool() const
{
   return data != 0;
}
}*/


template< typename Value,
+5 −3
Original line number Diff line number Diff line
@@ -216,11 +216,11 @@ TYPED_TEST( ArrayTest, setSize )
   EXPECT_NE( v.getData(), u.getData() );

   // cast to bool returns true iff size > 0
   EXPECT_TRUE( (bool) u );
   /*EXPECT_TRUE( (bool) u );
   EXPECT_FALSE( ! u );
   u.setSize( 0 );
   EXPECT_FALSE( (bool) u );
   EXPECT_TRUE( ! u );
   EXPECT_TRUE( ! u );*/
}

TYPED_TEST( ArrayTest, setLike )
@@ -462,7 +462,9 @@ TYPED_TEST( ArrayTest, assignmentOperator )
      u_host.setElement( i, i );
   }

   v.setValue( 0 );
   v = 72; //.setValue( 0 );
   for( int i = 0; i < 10; i++ )
      EXPECT_EQ( v[ i ], 72 );
   v = u;
   EXPECT_EQ( u, v );