[Avida-SVN] r2014 - development/source/tools

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Mon Aug 27 09:49:19 PDT 2007


Author: brysonda
Date: 2007-08-27 12:49:19 -0400 (Mon, 27 Aug 2007)
New Revision: 2014

Modified:
   development/source/tools/tArray.h
Log:
Fix the implementation of tArray::operator+.

Modified: development/source/tools/tArray.h
===================================================================
--- development/source/tools/tArray.h	2007-08-27 15:19:17 UTC (rev 2013)
+++ development/source/tools/tArray.h	2007-08-27 16:49:19 UTC (rev 2014)
@@ -75,15 +75,11 @@
     return *this;
   }
 
-  tArray operator+(const tArray in) const {
-    tArray tmp(0);
-    for(int i = 0; i < GetSize(); i++) {
-      tmp.Push(m_data[i]);
-    }
-    
-    for(int i = 0; i < in.GetSize(); i++) {
-      tmp.Push(in[i]);
-    }
+  inline tArray operator+(const tArray& in_array) const {
+    tArray tmp(m_size + in_array.m_size);
+    for(int i = 0; i < m_size; i++) tmp[i] = m_data[i];
+    for(int i = 0; i < in_array.GetSize(); i++) tmp[i + m_size] = in_array[i];
+
     return tmp;
   }
   




More information about the Avida-cvs mailing list