The master branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:c5fd1a483858c0e85b40149aef88be00f94980a7

commit r15-3650-gc5fd1a483858c0e85b40149aef88be00f94980a7
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Tue Jan 9 23:39:14 2024 +0000

    libstdc++: Make PSTL algorithms accept C++20 iterators [PR110512]
    
    This is a step towards implementing the C++23 change P2408R5, "Ranges
    iterators as inputs to non-Ranges algorithms". C++20 random access
    iterators which do not meet the Cpp17RandomAccessIterator requirements
    will now be recognized by the PSTL algorithms.
    
    As noted by Patrick, P2408R5 only relaxes the requirements for
    non-mutating algorithms, but this relaxes them for all parallel
    algorithms. I believe that's OK. A call with a type which previously
    didn't compile at all was undefined, so we're allowed to start accepting
    those calls if the type satisfies std::random_access_iterator. However,
    this also causes a change in behaviour for calls with arguments which
    satisfy std::random_access_iterator and meet the Cpp17ForwardIterator
    requirements but not the Cpp17RandomAccessIterator requirements. The
    algorithms will dispatch to a different implementation now. I believe
    that's also OK. The algorithms should give the same results whether
    acting on forward iterators or random access iterators, just more
    efficiently for the latter.
    
    Additionally, we can optimize the C++17 implementation by using
    std::__and_, and use std::__remove_cvref_t and std::__iter_category_t
    for readability.  This diverges from the upstream PSTL, but since libc++
    is no longer using that upstream (so we're the only consumer of this
    code) I think it's reasonable to use libstdc++ extensions in localized
    places like this. Rebasing this small header on upstream should not be
    difficult.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/110512
            * include/pstl/execution_impl.h (__are_random_access_iterators):
            Recognize C++20 random access iterators, and use more efficient
            implementations.
            * testsuite/25_algorithms/pstl/110512.cc: New test.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2030797

Title:
  Parallel C++ algorithms run sequentially

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/2030797/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to