aboutsummaryrefslogtreecommitdiff
path: root/src/array.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-01-17 05:38:42 +0000
committerMike Buland <eichlan@xagasoft.com>2012-01-17 05:38:42 +0000
commit85524a0050459146e6ffbce74f998cb789ed48b5 (patch)
treeca442fd676ef3478ea0ad2558047c6aa5d0b4867 /src/array.h
parent156ce25ce08fe67556e812f9361bf4ad57b860c5 (diff)
downloadlibbu++-85524a0050459146e6ffbce74f998cb789ed48b5.tar.gz
libbu++-85524a0050459146e6ffbce74f998cb789ed48b5.tar.bz2
libbu++-85524a0050459146e6ffbce74f998cb789ed48b5.tar.xz
libbu++-85524a0050459146e6ffbce74f998cb789ed48b5.zip
Added some extras to the array class...it's kind of lagging behind the others.
Diffstat (limited to '')
-rw-r--r--src/array.h38
1 files changed, 38 insertions, 0 deletions
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
197 197
198 return *this; 198 return *this;
199 } 199 }
200
201 MyType &append( const MyType &rVal )
202 {
203 _hardCopy();
204
205 if( core->iSize + rVal.core->iSize > core->iCapacity )
206 {
207 core->setCapacity( core->iSize + rVal.core->iSize + inc );
208 }
209
210 for( int j = 0; j < rVal.core->iSize; j++ )
211 {
212 core->va.construct(
213 &core->pData[core->iSize++],
214 rVal.core->pData[j]
215 );
216 }
217
218 return *this;
219 }
200 220
201 //operator 221 //operator
202 value &operator[]( long iIndex ) 222 value &operator[]( long iIndex )
@@ -427,6 +447,11 @@ namespace Bu
427 long iPos; 447 long iPos;
428 448
429 public: 449 public:
450 const_iterator( iterator &rSrc ) :
451 src( rSrc.src ),
452 iPos( rSrc.iPos )
453 {
454 }
430 const_iterator operator++( int ) 455 const_iterator operator++( int )
431 { 456 {
432 if( iPos < 0 ) 457 if( iPos < 0 )
@@ -570,6 +595,19 @@ namespace Bu
570 core->erase( i.iPos ); 595 core->erase( i.iPos );
571 } 596 }
572 597
598 void erase( const value &v )
599 {
600 _hardCopy();
601 for( int j = 0; j < core->iSize; j++ )
602 {
603 if( core->pData[j] == v )
604 {
605 core->erase( j );
606 return;
607 }
608 }
609 }
610
573 void eraseLast() 611 void eraseLast()
574 { 612 {
575 _hardCopy(); 613 _hardCopy();