Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mital Ashok <[email protected]>
  • Loading branch information
mordante and MitalAshok authored Jul 7, 2024
1 parent 2e82109 commit 78dedd7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct increasing_allocator {
if (allocation_amount < min_bytes)
allocation_amount = min_bytes;
min_bytes += 1000;
return {static_cast<T*>(::operator new(allocation_amount)), allocation_amount};
return {static_cast<T*>(::operator new(allocation_amount)), allocation_amount/sizeof(T)};
}
T* allocate(std::size_t n) { return allocate_at_least(n).ptr; }
void deallocate(T* p, std::size_t) noexcept { ::operator delete(static_cast<void*>(p)); }
Expand All @@ -103,7 +103,7 @@ void test_increasing_allocator() {
assert(is_contiguous_container_asan_correct(v));
std::size_t capacity = v.capacity();
v.shrink_to_fit();
assert(v.capacity() == capacity);
assert(v.capacity() <= capacity);
assert(v.size() == 1);
assert(is_contiguous_container_asan_correct(v));
}
Expand Down

0 comments on commit 78dedd7

Please sign in to comment.