-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!
Description
WG21-N4958 [deque.capacity]/6:
Effects:
shrink_to_fitis 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."
We unconditionally move, which is a bug:
Line 998 in 283cf32
| deque _Tmp(_STD make_move_iterator(begin()), _STD make_move_iterator(end())); |
(#4071 is patching this line in an unrelated way.)
vector provides its strong guarantees correctly, like this (note that it doesn't directly use move_if_noexcept()):
Lines 837 to 842 in 283cf32
| if (_Whereptr == _Mylast) { // at back, provide strong guarantee | |
| if constexpr (is_nothrow_move_constructible_v<_Ty> || !is_copy_constructible_v<_Ty>) { | |
| _Uninitialized_move(_Myfirst, _Mylast, _Newvec, _Al); | |
| } else { | |
| _Uninitialized_copy(_Myfirst, _Mylast, _Newvec, _Al); | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!