diff options
Diffstat (limited to '')
-rw-r--r-- | src/stable/array.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/stable/array.h b/src/stable/array.h index a598865..a662705 100644 --- a/src/stable/array.h +++ b/src/stable/array.h | |||
@@ -297,6 +297,30 @@ namespace Bu | |||
297 | return core->iSize; | 297 | return core->iSize; |
298 | } | 298 | } |
299 | 299 | ||
300 | void setSize( long iNewLen, const value &initTo=value() ) | ||
301 | { | ||
302 | if( core->iSize == iNewLen ) | ||
303 | return; | ||
304 | |||
305 | _hardCopy(); | ||
306 | if( iNewLen > core->iCapacity ) | ||
307 | { | ||
308 | core->setCapacity( iNewLen ); | ||
309 | for( int j = core->iSize; j < iNewLen; j++ ) | ||
310 | { | ||
311 | core->va.construct( | ||
312 | &core->pData[j], | ||
313 | initTo | ||
314 | ); | ||
315 | } | ||
316 | core->iSize = iNewLen; | ||
317 | } | ||
318 | else | ||
319 | { | ||
320 | core->iSize = iNewLen; | ||
321 | } | ||
322 | } | ||
323 | |||
300 | /** | 324 | /** |
301 | * Get the capacity of the array. This number will grow as data is | 325 | * Get the capacity of the array. This number will grow as data is |
302 | * added, and is mainly for the curious, it doesn't really determine | 326 | * added, and is mainly for the curious, it doesn't really determine |