[patch] std::vector::assign should not call std::vector::swap
Thu Sep 25 12:14:00 GMT 2014
With C++11 allocator semantics the swap() member might also replace
the allocator, which is only allowed in specific circumstances.
Even though the worst that could happen is we replace the allocator
with an equal one, we should avoid using swap and use the internal
_M_swap_data function instead.
I'm not adding a test, as I don't think this is likely to regress and
to do it properly we'd need to test every member function and ensure
only the correct ones replace the allocator. I searched, and we don't
use swap() inappropriately elsewhere in std::vector.
Tested x86_64-linux, committed to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 663 bytes
Desc: not available
More information about the Gcc-patches