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. --- mingw.bld | 2 +- src/array.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/mingw.bld b/mingw.bld index 29cdf31..bee0612 100644 --- a/mingw.bld +++ b/mingw.bld @@ -44,7 +44,7 @@ target "libbu++win.a" CXXFLAGS += "-I. -Isupport/windows"; } -target "src/process.win_o" +target ["src/process.win_o", "src/deflate.win_o", "src/lzma.win_o"] { profile "build" { 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