From 80b422a783adaf2ebe15aa2c205271d8b2cf2075 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com>
Date: Wed, 10 Apr 2019 21:03:54 +0200
Subject: [PATCH] One more fix of array assignment.

---
 src/TNL/Containers/Algorithms/ArrayAssignment.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/TNL/Containers/Algorithms/ArrayAssignment.h b/src/TNL/Containers/Algorithms/ArrayAssignment.h
index 0d3a9b145a..62ab43a84a 100644
--- a/src/TNL/Containers/Algorithms/ArrayAssignment.h
+++ b/src/TNL/Containers/Algorithms/ArrayAssignment.h
@@ -50,9 +50,14 @@ template< typename Array,
           typename T >
 struct ArrayAssignment< Array, T, true >
 {
-   static void assign( Array& a, const T& t )
+   static void resize( Array& a, const T& t )
    {
       a.setSize( t.getSize() );
+   }
+
+   static void assign( Array& a, const T& t )
+   {
+      TNL_ASSERT_EQ( a.getSize(), t.getSize(), "The sizes of the arrays must be equal." );
       if( t.getSize() > 0 ) // we allow even assignment of empty arrays
          ArrayOperations< typename Array::DeviceType, typename T::DeviceType >::template
             copyMemory< typename Array::ValueType, typename T::ValueType, typename Array::IndexType >
@@ -68,6 +73,9 @@ template< typename Array,
           typename T >
 struct ArrayAssignment< Array, T, false >
 {
+   static void resize( Array& a, const T& t )
+   {
+   };
    static void assign( Array& a, const T& t )
    {
       TNL_ASSERT_FALSE( a.empty(), "Cannot assign value to empty array." );
-- 
GitLab