aboutsummaryrefslogtreecommitdiff
path: root/src/array.h
diff options
context:
space:
mode:
authorDavid <david@xagasoft.com>2008-11-11 01:06:28 +0000
committerDavid <david@xagasoft.com>2008-11-11 01:06:28 +0000
commitf5b9d8d923822c31b98b39ba0fabae24fadc6d9c (patch)
tree34cdea37633298b7b4e95a5d4df6b451d7dd3a69 /src/array.h
parent4bbeb6208ac33f71a09701cc5251f0412977946e (diff)
downloadlibbu++-f5b9d8d923822c31b98b39ba0fabae24fadc6d9c.tar.gz
libbu++-f5b9d8d923822c31b98b39ba0fabae24fadc6d9c.tar.bz2
libbu++-f5b9d8d923822c31b98b39ba0fabae24fadc6d9c.tar.xz
libbu++-f5b9d8d923822c31b98b39ba0fabae24fadc6d9c.zip
david - added operator= and copy constructor to Bu::Array, and updated unit tests to test it
Diffstat (limited to '')
-rw-r--r--src/array.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/array.h b/src/array.h
index 30d281a..1f11cd9 100644
--- a/src/array.h
+++ b/src/array.h
@@ -42,6 +42,7 @@ namespace Bu
42 iSize( 0 ), 42 iSize( 0 ),
43 iCapacity( 0 ) 43 iCapacity( 0 )
44 { 44 {
45 *this = src;
45 } 46 }
46 47
47 Array( long iSetCap ) : 48 Array( long iSetCap ) :
@@ -57,6 +58,16 @@ namespace Bu
57 clear(); 58 clear();
58 } 59 }
59 60
61 MyType &operator=( const MyType &src )
62 {
63 clear();
64 setCapacity( src.iCapacity );
65 long iTop=src.getSize();
66 for( long i=0; i<iTop; ++i )
67 append( src[i] );
68 return *this;
69 }
70
60 /** 71 /**
61 * Clear the array. 72 * Clear the array.
62 */ 73 */