WG21-N4958 [deque.capacity]/6:
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-Cpp17CopyInsertable T, then there are no effects."
We unconditionally move, which is a bug:
|
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()):
|
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);
|
|
}
|
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.)
vectorprovides 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