Skip to content

Commit

Permalink
utils/chunked_managed_vector: expose max_chunk_capacity()
Browse files Browse the repository at this point in the history
That's useful for tests which want to verify correctness when the
vector is performing operations across the chunk boundary.

Signed-off-by: Raphael S. Carvalho <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
raphaelsc authored and tgrabiec committed Apr 8, 2022
1 parent 41fe01e commit 2c11673
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/lsa/chunked_managed_vector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ class chunked_managed_vector {
managed_vector<chunk_ptr, 1> _chunks;
size_t _size = 0;
size_t _capacity = 0;
private:
public:
static size_t max_chunk_capacity() {
return std::max(max_contiguous_allocation / sizeof(T), size_t(1));
}
private:
void reserve_for_push_back() {
if (_size == _capacity) {
do_reserve_for_push_back();
Expand Down

0 comments on commit 2c11673

Please sign in to comment.