diff options
Diffstat (limited to 'src/array.h')
-rw-r--r-- | src/array.h | 38 |
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(); |