@@ -43,27 +43,6 @@ class PoolAddressAllocator : public AddressAllocatorBase<PoolAddressAllocator<_s
43
43
}
44
44
}
45
45
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
-
67
46
inline bool safe_shrink_size_common (_size_type& sizeBound, _size_type newBuffAlignmentWeCanGuarantee) noexcept
68
47
{
69
48
_size_type capacity = get_total_size ()-Base::alignOffset;
@@ -101,10 +80,13 @@ class PoolAddressAllocator : public AddressAllocatorBase<PoolAddressAllocator<_s
101
80
// ! When resizing we require that the copying of data buffer has already been handled by the user of the address allocator
102
81
template <typename ... Args>
103
82
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)...),
105
84
blockCount ((newBuffSz-Base::alignOffset)/other.blockSize), blockSize(other.blockSize), freeStackCtr(0u )
106
85
{
107
- copyStateMove (other.blockCount , other.freeStackCtr , newBuffSz);
86
+ copyState (other, newBuffSz);
87
+
88
+ Base::operator =(std::move (other));
89
+ std::swap (reservedSpace, other.reservedSpace );
108
90
109
91
other.blockCount = invalid_address;
110
92
other.blockSize = invalid_address;
0 commit comments