xtd 0.2.0
Loading...
Searching...
No Matches

◆ shrink_to_fit()

template<typename type_t , typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>::type>>
virtual void xtd::collections::generic::list< type_t, allocator_t >::shrink_to_fit ( )
inlinevirtual

Requests the removal of unused capacity.

Remarks
It is a non-binding request to reduce xtd::collections::generic::list::capacity() to xtd::collections::generic::list::size(). It depends on the implementation whether the request is fulfilled.
If reallocation occurs, all iterators (including the xtd::collections::generic::list::end() iterator) and all references to the elements are invalidated. If no reallocation occurs, no iterators or references are invalidated.