You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Effects:shrink_to_fit is a non-binding request to reduce memory use but does not change the size of the sequence.
[Note 1: The request is non-binding to allow latitude for implementation-specific optimizations. - end note]
If the size is equal to the old capacity, or if an exception is thrown other than by the move constructor of a non-Cpp17CopyInsertableT, then there are no effects."
Reallocation of elements doesn't seem valuable since the current block size of deque is unwisely small. I think we should just deallocate unused blocks and shrink the internal map.
StephanTLavavej
changed the title
<deque>: shrink_to_fit() should have move_if_noexcept() logic<deque>: shrink_to_fit() should follow the Standard
Jan 26, 2024
WG21-N4958 [deque.capacity]/6:
We unconditionally move, which is a bug:
STL/stl/inc/deque
Line 998 in 283cf32
(#4071 is patching this line in an unrelated way.)
vector
provides its strong guarantees correctly, like this (note that it doesn't directly usemove_if_noexcept()
):STL/stl/inc/vector
Lines 837 to 842 in 283cf32
The text was updated successfully, but these errors were encountered: