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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:2a36d22ab52d6ffce9a1fcaf7aca83336679e111

commit r15-9211-g2a36d22ab52d6ffce9a1fcaf7aca83336679e111
Author: Patrick Palka <ppa...@redhat.com>
Date:   Fri Apr 4 15:05:09 2025 -0400

    libstdc++: Avoid redundant value_type object in flat_set::emplace
[PR119620]

    flat_set::emplace (and flat_multiset's) currently unconditionally
    constructs an object outside of the container, but if we're passed
    a value_type object we can and should avoid that.

            PR libstdc++/119620

    libstdc++-v3/ChangeLog:

            * include/std/flat_set (_Flat_set_impl::_M_try_emplace): Split
            out into two overloads, one taking at least one argument and one
            taking zero arguments.  Turn __k into an auto&& reference bound
            to __arg if it's already a value_type and otherwise bound to a
            lifetime-extended value_type temporary.
            * testsuite/23_containers/flat_multiset/1.cc (test08): New test.
            * testsuite/23_containers/flat_set/1.cc (test08): New test.

    Reviewed-by: Tomasz KamiÅski <tkami...@redhat.com>
    Reviewed-by: Jonathan Wakely <jwak...@redhat.com>

Reply via email to