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

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tomasz Kaminski <tkami...@gcc.gnu.org>:

https://gcc.gnu.org/g:157c14a387fc880b31e9e42deb6960b3143d3c2d

commit r15-8922-g157c14a387fc880b31e9e42deb6960b3143d3c2d
Author: Tomasz KamiÅski <tkami...@redhat.com>
Date:   Fri Mar 21 09:03:54 2025 +0100

    libstdc++: Add P1206R7 range operations to std::deque [PR111055]

    This is another piece of P1206R7, adding from_range constructor,
append_range,
    prepend_range, insert_range, and assign_range members to std::deque.

    For append_front of input non-sized range, we are emplacing element at the
front and
    then reverse inserted elements. This does not existing elements, and
properly handle
    aliasing ranges.

    For insert_range, the handling of insertion in the middle of input-only
ranges
    that are sized could be optimized, we still insert nodes one-by-one in such
case.
    For forward and stronger ranges, we reduce them to common_range case, by
computing
    the iterator when computing the distance. This is slightly suboptimal, as
it require
    range to be iterated for non-common forward ranges that are sized, but
reduces
    number of instantiations.

    This patch extract _M_range_prepend, _M_range_append helper functions that
accepts
    (iterator, sentinel) pair. This all used in all standard modes.

            PR libstdc++/111055

    libstdc++-v3/ChangeLog:

            * include/bits/deque.tcc (deque::prepend_range,
deque::append_range)
            (deque::insert_range, __advance_dist): Define.
            (deque::_M_range_prepend, deque::_M_range_append):
            Extract from _M_range_insert_aux for _ForwardIterator(s).
            * include/bits/stl_deque.h (deque::assign_range): Define.
            (deque::prepend_range, deque::append_range, deque::insert_range):
            Declare.
            (deque(from_range_t, _Rg&&, const allocator_type&)): Define
constructor
            and deduction guide.
            * include/debug/deque (deque::prepend_range, deque::append_range)
            (deque::assign_range):  Define.
            (deque(from_range_t, _Rg&&, const allocator_type&)): Define
constructor
            and deduction guide.
            * testsuite/23_containers/deque/cons/from_range.cc: New test.
            * testsuite/23_containers/deque/modifiers/append_range.cc: New
test.
            * testsuite/23_containers/deque/modifiers/assign/assign_range.cc:
            New test.
            * testsuite/23_containers/deque/modifiers/prepend_range.cc: New
test.

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

Reply via email to