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

             Bug #: 54064
           Summary: C++11 unordered_map emplace
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: martin.ale...@hotmail.fr


Hello,

Sorry for my english I'm french.

I noticed an issue with std::unordered_map::emplace member function: it should
use the first variadic argument to construct the key, and the other arguments
to construct a mapped_type object, instead of constructing directly a std::pair
object.

For example, we should be able to do that:
std::unordered_map<int, std::pair<int, int>> m;
m.emplace(1, 2, 3);

instead of:
std::unordered_map<int, std::pair<int, int>> m;
m.emplace(1, std::make_pair(2, 3));

It would be useful to correct this function because it would avoid an extra
move operation.

Thank you

Reply via email to