[Bug libstdc++/86127] STL containers do not satisfy container.requirements.general clause 8

fidget324 at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 13 17:36:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86127

--- Comment #7 from Scott Constable <fidget324 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> The allocator requirements say that move construction must be equivalent to
> copy construction, and allocators should be cheap to copy anyway. I don't
> consider this a bug.

To be nitpicky, it looks like this equivalence requirement was introduced
recently in the C++20 draft. I'm compiling using C++14.

I agree that allocators should be cheap to copy, but as a general principle I
think that all objects should be copied only when necessary. This is the
behavior I have observed in STL containers in libc++, as shown in my example
above. It just makes sense to me that when an STL container is moved, its
allocator should be moved, and no copying should be performed.


More information about the Gcc-bugs mailing list