PR libstdc++/78595 implement insertion into maps in terms of emplace
commit01b2b7a573c086f3e0ea820f78c56a99b73228b3
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Sep 2018 14:25:12 +0000 (3 14:25 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Sep 2018 14:25:12 +0000 (3 14:25 +0000)
treed1599d3dc442dce5d10470f835ebc341956a59ae
parent661fdbbb031bbc6d46c52523b1842493b31737eb
PR libstdc++/78595 implement insertion into maps in terms of emplace

C++14 simplified the specification of the generic insert function
templates to be equivalent to calling emplace (or emplace_hint).
Defining them in terms of emplace takes care of the problems described
in PR 78595, ensuring a single conversion to value_type is done at the
right time.

PR libstdc++/78595
* include/bits/stl_map.h (map::insert(_Pair&&))
(map::insert(const_iterator, _Pair&&)): Do emplace instead of insert.
* include/bits/stl_multimap.h (multimap::insert(_Pair&&))
(multimap::insert(const_iterator, _Pair&&)): Likewise.
* include/bits/unordered_map.h (unordered_map::insert(_Pair&&))
(unordered_map::insert(const_iterator, _Pair&&))
(unordered_multimap::insert(_Pair&&))
(unordered_multimap::insert(const_iterator, _Pair&&)): Likewise.
* testsuite/23_containers/map/modifiers/insert/78595.cc: New test.
* testsuite/23_containers/multimap/modifiers/insert/78595.cc: New test.
* testsuite/23_containers/unordered_map/modifiers/78595.cc: New test.
* testsuite/23_containers/unordered_multimap/modifiers/78595.cc: New
test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264059 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/unordered_map.h
libstdc++-v3/testsuite/23_containers/map/modifiers/insert/78595.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multimap/modifiers/insert/78595.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/78595.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_multimap/modifiers/78595.cc [new file with mode: 0644]