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"
24 test(typename
S::size_type min_cap
, typename
S::size_type erased_index
)
27 s
.erase(erased_index
);
28 assert(s
.size() == erased_index
);
29 assert(s
.capacity() >= min_cap
); // Check that we really have at least this capacity.
31 typename
S::size_type old_cap
= s
.capacity();
34 LIBCPP_ASSERT(s
.__invariants());
36 assert(s
.capacity() <= old_cap
);
37 assert(s
.capacity() >= s
.size());
43 typedef std::string S
;
50 #if TEST_STD_VER >= 11
52 typedef std::basic_string
<char, std::char_traits
<char>, min_allocator
<char>> S
;