44 template <
typename TValue,
unsigned int N,
unsigned int M>
49 template <
typename TValue,
unsigned int N,
unsigned int M>
52 : myIdx( 0 ), myValues( 0 )
55 template <
typename TValue,
unsigned int N,
unsigned int M>
58 : myIdx( other.myIdx ), myNbValues( other.myNbValues ),
59 myValues( other.myValues ), myNext( other.myNext )
62 template <
typename TValue,
unsigned int N,
unsigned int M>
66 ASSERT( idx <= block.
size );
67 if ( block.
size <= N+1 )
100 myNext = ( myNext != 0 ) ? myNext->next : 0;
112 myValues = myNext->values;
118 template <
typename TValue,
unsigned int N,
unsigned int M>
124 if (
this != &other )
134 template <
typename TValue,
unsigned int N,
unsigned int M>
140 ASSERT( myValues != 0 );
141 return myValues[ myIdx ];
144 template <
typename TValue,
unsigned int N,
unsigned int M>
150 ASSERT( myValues != 0 );
151 return myValues + myIdx;
154 template <
typename TValue,
unsigned int N,
unsigned int M>
160 return this->operator+=( 1 );
163 template <
typename TValue,
unsigned int N,
unsigned int M>
174 template <
typename TValue,
unsigned int N,
unsigned int M>
180 return ( myValues == other.
myValues ) && ( myIdx == other.
myIdx );
183 template <
typename TValue,
unsigned int N,
unsigned int M>
189 return ( myValues != other.
myValues ) || ( myIdx != other.
myIdx );
192 template <
typename TValue,
unsigned int N,
unsigned int M>
199 while ( myIdx >= myNbValues )
208 myValues = myNext->values;
210 myNext = myNext->next;
215 template <
typename TValue,
unsigned int N,
unsigned int M>
229 template <
typename TValue,
unsigned int N,
unsigned int M>
234 template <
typename TValue,
unsigned int N,
unsigned int M>
237 : myIdx( 0 ), myValues( 0 )
240 template <
typename TValue,
unsigned int N,
unsigned int M>
243 : myIdx( other.myIdx ), myNbValues( other.myNbValues ),
244 myValues( other.myValues ), myNext( other.myNext )
247 template <
typename TValue,
unsigned int N,
unsigned int M>
251 ASSERT( idx <= block.
size );
252 if ( block.
size <= N+1 )
285 myNext = ( myNext != 0 ) ? myNext->next : 0;
297 myValues = myNext->values;
303 template <
typename TValue,
unsigned int N,
unsigned int M>
309 if (
this != &other )
319 template <
typename TValue,
unsigned int N,
unsigned int M>
325 ASSERT( myValues != 0 );
326 return myValues[ myIdx ];
329 template <
typename TValue,
unsigned int N,
unsigned int M>
335 ASSERT( myValues != 0 );
336 return myValues + myIdx;
339 template <
typename TValue,
unsigned int N,
unsigned int M>
345 return this->operator+=( 1 );
348 template <
typename TValue,
unsigned int N,
unsigned int M>
359 template <
typename TValue,
unsigned int N,
unsigned int M>
365 return ( myValues == other.
myValues ) && ( myIdx == other.
myIdx );
368 template <
typename TValue,
unsigned int N,
unsigned int M>
374 return ( myValues != other.
myValues ) || ( myIdx != other.
myIdx );
377 template <
typename TValue,
unsigned int N,
unsigned int M>
384 while ( myIdx >= myNbValues )
393 myValues = myNext->values;
395 myNext = myNext->next;
400 template <
typename TValue,
unsigned int N,
unsigned int M>
413 template <
typename TValue,
unsigned int N,
unsigned int M>
420 template <
typename TValue,
unsigned int N,
unsigned int M>
428 template <
typename TValue,
unsigned int N,
unsigned int M>
434 unsigned int s = N + 1;
439 *currentPointer =
new AnyBlock( *nextBlock );
441 currentPointer = & ( currentPointer->data.nextBlock );
445 template <
typename TValue,
unsigned int N,
unsigned int M>
451 if (
this != &other )
456 unsigned int s = N + 1;
458 AnyBlock** currentPointer = & myFirstBlock.data.nextBlock;
459 while ( s < myFirstBlock.size )
461 *currentPointer =
new AnyBlock( *nextBlock );
463 currentPointer = & ( (*currentPointer)->next );
469 template <
typename TValue,
unsigned int N,
unsigned int M>
475 AnyBlock* nextBlock = myFirstBlock.data.nextBlock;
476 while ( nextBlock != 0 )
479 nextBlock = nextBlock->
next;
482 myFirstBlock.size = 0;
483 myFirstBlock.data.nextBlock = 0;
486 template <
typename TValue,
unsigned int N,
unsigned int M>
492 return myFirstBlock.
size;
495 template <
typename TValue,
unsigned int N,
unsigned int M>
504 template <
typename TValue,
unsigned int N,
unsigned int M>
513 template <
typename TValue,
unsigned int N,
unsigned int M>
519 return ( size() <= (N+1) )
521 : ( 1 + ( size() - 1 - N ) / M ) * M + N;
524 template <
typename TValue,
unsigned int N,
unsigned int M>
530 ASSERT( idx < size() );
532 return myFirstBlock.values[ idx ];
533 else if ( ( idx == N ) && ( size() == N+1 ) )
534 return myFirstBlock.data.lastValue;
535 const AnyBlock* ptr = myFirstBlock.data.nextBlock;
543 return ptr->
values[ idx ];
546 template <
typename TValue,
unsigned int N,
unsigned int M>
552 ASSERT( idx < size() );
554 return myFirstBlock.values[ idx ];
555 else if ( ( idx == N ) && ( size() == N+1 ) )
556 return myFirstBlock.data.lastValue;
557 AnyBlock* ptr = myFirstBlock.data.nextBlock;
565 return ptr->
values[ idx ];
568 template <
typename TValue,
unsigned int N,
unsigned int M>
574 ASSERT( idx <= size() );
575 myFirstBlock.insert( idx, value );
578 template <
typename TValue,
unsigned int N,
unsigned int M>
584 ASSERT( idx < size() );
585 myFirstBlock.erase( idx );
590 template <
typename TValue,
unsigned int N,
unsigned int M>
599 template <
typename TValue,
unsigned int N,
unsigned int M>
605 return Iterator( myFirstBlock, size() );
608 template <
typename TValue,
unsigned int N,
unsigned int M>
617 template <
typename TValue,
unsigned int N,
unsigned int M>
633 template <
typename TValue,
unsigned int N,
unsigned int M>
639 if ( size() == 0 ) out <<
"()";
648 for ( ; it != it_end; ++it )
650 out << ( ( it_last.
myValues == it.myValues ) ?
',' :
';' );
662 template <
typename TValue,
unsigned int N,
unsigned int M>
675 template <
typename TValue,
unsigned int N,
unsigned int M>
681 object.selfDisplay( out );