[Bug libstdc++/55043] [4.7/4.8 Regression] issue with nesting unordered_map containing unique_ptr into vector

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Wed Oct 24 18:51:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55043

--- Comment #19 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-24 18:51:24 UTC ---
Essentially memory allocation is needed because that is the "simplest" state
for such containers, what the default constructor also does in other terms.
Given that the moved from container must remain in a sane state and all the
normal operations must still be well defined, I don't think we can have
something "simpler", thus not allocating memory, than the default constructed
state. We can of course in principle redesign the affected containers to have a
different, simpler, default (it's already the case for containers like vector
or list, of course) but that isn't that easy to do, AFAICS. That said, I'm not
convinced this is the *real* issue, because: 1- I think a move-constructor not
noexcept is still conforming; 2- As we often say when teaching these things,
the std:: containers are just *examples* from the generic programming point of
view, and we should anyway be ready for user code with throwing move
constructors...



More information about the Gcc-bugs mailing list