https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78595

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Fri Oct 12 12:51:40 2018
New Revision: 265095

URL: https://gcc.gnu.org/viewcvs?rev=265095&root=gcc&view=rev
Log:
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.

Backport from mainline
2018-09-03  Jonathan Wakely  <jwak...@redhat.com>

        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.
        * include/std/type_traits (__enable_if_t): Define for C++11.
        * 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.

Added:
   
branches/gcc-7-branch/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/78595.cc
   
branches/gcc-7-branch/libstdc++-v3/testsuite/23_containers/multimap/modifiers/insert/78595.cc
   
branches/gcc-7-branch/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/78595.cc
   
branches/gcc-7-branch/libstdc++-v3/testsuite/23_containers/unordered_multimap/modifiers/78595.cc
Modified:
    branches/gcc-7-branch/libstdc++-v3/ChangeLog
    branches/gcc-7-branch/libstdc++-v3/include/bits/stl_map.h
    branches/gcc-7-branch/libstdc++-v3/include/bits/stl_multimap.h
    branches/gcc-7-branch/libstdc++-v3/include/bits/unordered_map.h
    branches/gcc-7-branch/libstdc++-v3/include/std/type_traits

Reply via email to