File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
libcxx/test/std/containers/sequences/vector Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -44,16 +44,18 @@ TEST_CONSTEXPR_CXX20 bool tests() {
44
44
45
45
// Fill the vector at its capacity, such that any subsequent push_back would require growing.
46
46
v.reserve (5 );
47
- for (std::size_t i = 0 ; i != 5 ; ++i) {
47
+ std::size_t const capacity = v.capacity (); // could technically be more than 5
48
+ while (v.size () < v.capacity ()) {
48
49
v.emplace_back (&track);
49
50
}
50
51
assert (track.move_constructs == 0 );
51
- assert (v.size () == 5 );
52
+ assert (v.capacity () == capacity);
53
+ assert (v.size () == capacity);
52
54
53
55
// Force a reallocation of the buffer + relocalization of the elements.
54
56
// All the existing elements of the vector should be move-constructed to their new location.
55
57
v.emplace_back (&track);
56
- assert (track.move_constructs == 5 );
58
+ assert (track.move_constructs == capacity );
57
59
58
60
return true ;
59
61
}
You can’t perform that action at this time.
0 commit comments