@@ -43,27 +43,6 @@ class PoolAddressAllocator : public AddressAllocatorBase<PoolAddressAllocator<_s
4343 }
4444 }
4545
46- void copyStateMove (_size_type otherBlockCount, _size_type otherFreeStackCtr, _size_type newBuffSz)
47- {
48- if (blockCount > otherBlockCount)
49- freeStackCtr = blockCount - otherBlockCount;
50-
51- #ifdef _NBL_DEBUG
52- assert (Base::checkResize (newBuffSz, Base::alignOffset));
53- #endif // _NBL_DEBUG
54-
55- for (_size_type i = 0u ; i < freeStackCtr; i++)
56- getFreeStack (i) = (blockCount - 1u - i) * blockSize + Base::combinedOffset;
57-
58- for (_size_type i = 0 ; i < otherFreeStackCtr; i++)
59- {
60- _size_type freeEntry = getFreeStack (i) - Base::combinedOffset;
61- // check in case of shrink
62- if (freeEntry < blockCount * blockSize)
63- getFreeStack (freeStackCtr++) = freeEntry + Base::combinedOffset;
64- }
65- }
66-
6746 inline bool safe_shrink_size_common (_size_type& sizeBound, _size_type newBuffAlignmentWeCanGuarantee) noexcept
6847 {
6948 _size_type capacity = get_total_size ()-Base::alignOffset;
@@ -101,10 +80,13 @@ class PoolAddressAllocator : public AddressAllocatorBase<PoolAddressAllocator<_s
10180 // ! When resizing we require that the copying of data buffer has already been handled by the user of the address allocator
10281 template <typename ... Args>
10382 PoolAddressAllocator (_size_type newBuffSz, PoolAddressAllocator&& other, Args&&... args) noexcept :
104- Base (std::move( other) ,std::forward<Args>(args)...),
83+ Base (other,std::forward<Args>(args)...),
10584 blockCount ((newBuffSz-Base::alignOffset)/other.blockSize), blockSize(other.blockSize), freeStackCtr(0u )
10685 {
107- copyStateMove (other.blockCount , other.freeStackCtr , newBuffSz);
86+ copyState (other, newBuffSz);
87+
88+ Base::operator =(std::move (other));
89+ std::swap (reservedSpace, other.reservedSpace );
10890
10991 other.blockCount = invalid_address;
11092 other.blockSize = invalid_address;
0 commit comments