// Otherwise, it will return the new pointer to the area. The old one shouldn't be used anymore.
// pre: ptr is a pointer to a memory area of size old_size and alignment align allocated by the allocator allocator.
// pre: new_size ≥ 1
-void* reallocate(allocator auto allocator, void* ptr, amy::size old_size, amy::size new_size, amy::size align) {
+void* reallocate(allocator auto& allocator, void* ptr, amy::size old_size, amy::size new_size, amy::size align) {
if (allocator.expand(ptr, old_size, new_size - old_size)) {
return ptr;
}
capacity_++;
} else if (auto new_data =
amy::reallocate(allocator, data, capacity_ * amy::byte_size<T>(), capacity_ * 2 * amy::byte_size<T>(), amy::byte_align<T>())) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdangling-pointer"
data = (T*)new_data;
-#pragma GCC diagnostic pop
capacity_ *= 2;
} else {
return false;