22 May
2024
22 May
'24
8:16 p.m.
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: https://github.com/boostorg/container/issues/279 Best, Ion