This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/54064] New: C++11 unordered_map emplace
- From: "martin.alex32 at hotmail dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 21 Jul 2012 16:06:33 +0000
- Subject: [Bug libstdc++/54064] New: C++11 unordered_map emplace
- Auto-submitted: auto-generated
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