Ejemplo n.º 1
0
 bool reallocateWithCopy(OldAllocator &oldAllocator, NewAllocator &newAllocator, block &b,
                         size_t n)
 {
   auto newBlock = newAllocator.allocate(n);
   if (!newBlock) {
     return false;
   }
   blockCopy(b, newBlock);
   oldAllocator.deallocate(b);
   b = newBlock;
   return true;
 }
 bool reallocate_with_copy(OldAllocator &oldAllocator, NewAllocator &newAllocator, block &b,
   size_t n) noexcept
 {
   auto newBlock = newAllocator.allocate(n);
   if (!newBlock) {
     return false;
   }
   block_copy(b, newBlock);
   oldAllocator.deallocate(b);
   b = newBlock;
   return true;
 }