| 525 | | incRefCount(*vI); |
|---|
| | 514 | // [0, oldSize[ contains entries that are being replaced |
|---|
| | 515 | this->editRawStorage().resize(newSize); |
|---|
| | 516 | |
|---|
| | 517 | StorageIter vI = this->editRawStorage().begin(); |
|---|
| | 518 | StorageIter vE = this->editRawStorage().begin() + oldSize; |
|---|
| | 519 | |
|---|
| | 520 | for(; vI != vE; ++vI) |
|---|
| | 521 | { |
|---|
| | 522 | ValueType pNewObj; |
|---|
| | 523 | |
|---|
| | 524 | MFieldTraits::copyFromBin(pMem, pNewObj); |
|---|
| | 525 | |
|---|
| | 526 | incRefCount(pNewObj); |
|---|
| | 527 | decRefCount(*vI ); |
|---|
| | 528 | |
|---|
| | 529 | *vI = pNewObj; |
|---|
| | 530 | } |
|---|
| | 531 | |
|---|
| | 532 | // [oldSize, newSize[ contains entries that are added |
|---|
| | 533 | MFieldTraits::copyFromBin(pMem, &(*vI), newSize - oldSize); |
|---|
| | 534 | |
|---|
| | 535 | vE = this->editRawStorage().end(); |
|---|
| | 536 | |
|---|
| | 537 | for(; vI != vE; ++vI) |
|---|
| | 538 | incRefCount(*vI); |
|---|
| | 540 | else |
|---|
| | 541 | { |
|---|
| | 542 | // [0, newSize[ contains entries that are being replaced |
|---|
| | 543 | StorageIter vI = this->editRawStorage().begin(); |
|---|
| | 544 | StorageIter vE = this->editRawStorage().begin() + newSize; |
|---|
| | 545 | |
|---|
| | 546 | for(; vI != vE; ++vI) |
|---|
| | 547 | { |
|---|
| | 548 | ValueType pNewObj; |
|---|
| | 549 | |
|---|
| | 550 | MFieldTraits::copyFromBin(pMem, pNewObj); |
|---|
| | 551 | |
|---|
| | 552 | incRefCount(pNewObj); |
|---|
| | 553 | decRefCount(*vI ); |
|---|
| | 554 | |
|---|
| | 555 | *vI = pNewObj; |
|---|
| | 556 | } |
|---|
| | 557 | |
|---|
| | 558 | // [newSize, oldSize[ contains entries that are being removed |
|---|
| | 559 | vE = this->editRawStorage().end(); |
|---|
| | 560 | |
|---|
| | 561 | for(; vI != vE; ++vI) |
|---|
| | 562 | decRefCount(*vI); |
|---|
| | 563 | |
|---|
| | 564 | this->editRawStorage().resize(newSize); |
|---|
| | 565 | } |
|---|
| | 566 | } |
|---|
| | 567 | else |
|---|
| | 568 | { |
|---|
| | 569 | this->clear(); |
|---|