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

--- Comment #1 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:a9172b107a24b244e0b71c2575dd6448d48b3ae3

commit r15-7310-ga9172b107a24b244e0b71c2575dd6448d48b3ae3
Author: Patrick Palka <ppa...@redhat.com>
Date:   Fri Jan 31 15:53:12 2025 -0500

    libstdc++: Fix flat_foo::insert_range for non-common ranges [PR118156]

    This fixes flat_map/multimap::insert_range by just generalizing the
    insert implementation to handle heterogenous iterator/sentinel pair.
    I'm not sure we can do better than this, e.g. we can't implement it in
    terms of the adapted containers' insert_range because that'd require two
    passes over the range.

    For flat_set/multiset, we can implement insert_range directly in terms
    of the adapted container's insert_range.  A fallback implementation
    is also provided if insert_range isn't available, as is the case for
    std::deque currently.

            PR libstdc++/118156

    libstdc++-v3/ChangeLog:

            * include/std/flat_map (_Flat_map_impl::_M_insert): Generalized
            version of insert taking heterogenous iterator/sentinel pair.
            (_Flat_map_impl::insert): Dispatch to _M_insert.
            (_Flat_map_impl::insert_range): Likewise.
            (flat_map): Export _Flat_map_impl::insert_range.
            (flat_multimap): Likewise.
            * include/std/flat_set (_Flat_set_impl::insert_range):
            Reimplement directly, not in terms of insert.
            (flat_set): Export _Flat_set_impl::insert_range.
            (flat_multiset): Likewise.
            * testsuite/23_containers/flat_map/1.cc (test06): New test.
            * testsuite/23_containers/flat_multimap/1.cc (test06): New test.
            * testsuite/23_containers/flat_multiset/1.cc (test06): New test.
            * testsuite/23_containers/flat_set/1.cc (test06): New test.

    Reviewed-by: Jonathan Wakely <jwak...@redhat.com>
  • [Bug libstdc++/118156] flat_set... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to