Files
2025-10-25 03:02:53 +03:00

1.4 KiB

[list.capacity]

23 Containers library [containers]

23.3 Sequence containers [sequences]

23.3.11 Class template list [list]

23.3.11.3 Capacity [list.capacity]

🔗

constexpr void resize(size_type sz);

1

#

Preconditions: T is Cpp17DefaultInsertable into list.

2

#

Effects: If size() < sz, appends sz - size() default-inserted elements to the sequence.

If sz <= size(), equivalent to:list::iterator it = begin(); advance(it, sz); erase(it, end());

🔗

constexpr void resize(size_type sz, const T& c);

3

#

Preconditions: T is Cpp17CopyInsertable into list.

4

#

Effects: As if by:if (sz > size()) insert(end(), sz-size(), c);else if (sz < size()) { iterator i = begin(); advance(i, sz); erase(i, end());}else ; // do nothing