4 Jun
2024
4 Jun
'24
12:08 p.m.
El 22/05/2024 a las 22:16, Ion Gaztañaga via Boost escribió:
Hi,
C) Swap is similar to a double move assignment.
The interesting situation is when one vector uses a dynamic buffer and the other one the internal buffer. Currently swap allocates also a dynamic buffer for the vector with the internal buffer.
Thanks for pointing this out. If the memory from the vector using the dynamic buffer can be transferred (e.g. equal allocators or propagate_on_container_swap is true), then we should avoid a new allocation transferring elements to the internal buffer. I've updated the issue:
The issues has been resolved. Now shrink_to_fit and swap should use the internal storage when appropriate ;-) Best, Ion