From 85524a0050459146e6ffbce74f998cb789ed48b5 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 17 Jan 2012 05:38:42 +0000 Subject: Added some extras to the array class...it's kind of lagging behind the others. --- src/array.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src') diff --git a/src/array.h b/src/array.h index f091a81..fcd800e 100644 --- a/src/array.h +++ b/src/array.h @@ -197,6 +197,26 @@ namespace Bu return *this; } + + MyType &append( const MyType &rVal ) + { + _hardCopy(); + + if( core->iSize + rVal.core->iSize > core->iCapacity ) + { + core->setCapacity( core->iSize + rVal.core->iSize + inc ); + } + + for( int j = 0; j < rVal.core->iSize; j++ ) + { + core->va.construct( + &core->pData[core->iSize++], + rVal.core->pData[j] + ); + } + + return *this; + } //operator value &operator[]( long iIndex ) @@ -427,6 +447,11 @@ namespace Bu long iPos; public: + const_iterator( iterator &rSrc ) : + src( rSrc.src ), + iPos( rSrc.iPos ) + { + } const_iterator operator++( int ) { if( iPos < 0 ) @@ -570,6 +595,19 @@ namespace Bu core->erase( i.iPos ); } + void erase( const value &v ) + { + _hardCopy(); + for( int j = 0; j < core->iSize; j++ ) + { + if( core->pData[j] == v ) + { + core->erase( j ); + return; + } + } + } + void eraseLast() { _hardCopy(); -- cgit v1.2.3