[Bug libstdc++/54064] New: C++11 unordered_map emplace
martin.alex32 at hotmail dot fr
gcc-bugzilla@gcc.gnu.org
Sat Jul 21 16:06:00 GMT 2012
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: unassigned@gcc.gnu.org
ReportedBy: martin.alex32@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
More information about the Gcc-bugs
mailing list