1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // void reserve(); // Deprecated in C++20.
13 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
19 #include "test_macros.h"
20 #include "min_allocator.h"
23 void test(typename
S::size_type min_cap
, typename
S::size_type erased_index
) {
25 s
.erase(erased_index
);
26 assert(s
.size() == erased_index
);
27 assert(s
.capacity() >= min_cap
); // Check that we really have at least this capacity.
29 typename
S::size_type old_cap
= s
.capacity();
32 LIBCPP_ASSERT(s
.__invariants());
34 assert(s
.capacity() <= old_cap
);
35 assert(s
.capacity() >= s
.size());
46 test_string
<std::string
>();
47 #if TEST_STD_VER >= 11
48 test_string
<std::basic_string
<char, std::char_traits
<char>, min_allocator
<char>>>();
54 int main(int, char**) {