This is the mail archive of the
mailing list for the GCC project.
Re: Value type of map need not be default copyable
On Tue, 7 Aug 2012, Richard Smith wrote:
I've attached a patch for unordered_map which solves the rvalue
reference problem. ÂFor efficiency, I've created a new
_M_emplace_bucket method rather than call emplace directly.
I've verified all libstdc++ tests pass (sorry for the previous
oversight) and am running the full GCC test suite now. ÂHowever, I'd
appreciate any feedback on whether this is a reasonable approach. ÂSTL
hacking is way outside my comfort zone. Â;-)
If this looks good, I'll take a stab at std::map.
I think you should remove the mapped_type() argument from the call to
_M_emplace_bucket. In C++11, the mapped_type is not required to be copyable
at all, just to be DefaultInsertable.
Indeed. The reason I was talking about emplace is that you want an object
to be created only at the time the node is created. That might mean
passing piecewise_construct_t and an empty tuple to emplace (otherwise it
is too similar to insert). Or for unordered_map where the node functions
are "exposed", you could just create the node directly without passing