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() {
4444
4545 // Fill the vector at its capacity, such that any subsequent push_back would require growing.
4646 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 ()) {
4849 v.emplace_back (&track);
4950 }
5051 assert (track.move_constructs == 0 );
51- assert (v.size () == 5 );
52+ assert (v.capacity () == capacity);
53+ assert (v.size () == capacity);
5254
5355 // Force a reallocation of the buffer + relocalization of the elements.
5456 // All the existing elements of the vector should be move-constructed to their new location.
5557 v.emplace_back (&track);
56- assert (track.move_constructs == 5 );
58+ assert (track.move_constructs == capacity );
5759
5860 return true ;
5961}
You can’t perform that action at this time.
0 commit comments