Skip to content

Commit 4696d88

Browse files
committed
Add comment for increasing_allocator
1 parent d654ed4 commit 4696d88

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

libcxx/test/support/increasing_allocator.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,22 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef INCREASING_ALLOCATOR_H
10-
#define INCREASING_ALLOCATOR_H
9+
#ifndef TEST_SUPPORT_INCREASING_ALLOCATOR_H
10+
#define TEST_SUPPORT_INCREASING_ALLOCATOR_H
1111

1212
#include <cstddef>
1313
#include <memory>
1414

1515
#include "test_macros.h"
1616

1717
#if TEST_STD_VER >= 23
18+
19+
// increasing_allocator is a custom allocator that maintains an incrementing minimum allocation size,
20+
// requiring that each call to allocate_at_least allocate at least this minimum size, which may exceed
21+
// the requested amount. This unique design makes increasing_allocator particularly useful for testing
22+
// the shrink_to_fit functionality in std::vector, vector<bool>, and std::basic_string, ensuring that
23+
// shrink_to_fit does not increase the capacity of the allocated memory.
24+
1825
template <typename T>
1926
struct increasing_allocator {
2027
using value_type = T;
@@ -40,4 +47,4 @@ bool operator==(increasing_allocator<T>, increasing_allocator<U>) {
4047
}
4148
#endif // TEST_STD_VER >= 23
4249

43-
#endif // INCREASING_ALLOCATOR_H
50+
#endif // TEST_SUPPORT_INCREASING_ALLOCATOR_H

0 commit comments

Comments
 (0)