[all-commits] [llvm/llvm-project] b4d2b2: [libc++][pstl] Implementation of parallel std::lex...

Michael G. Kazakov via All-commits all-commits at lists.llvm.org
Thu Jul 30 18:06:59 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b4d2b2f9a31ba82b5bcbf9060748bde8beae814b
      https://github.com/llvm/llvm-project/commit/b4d2b2f9a31ba82b5bcbf9060748bde8beae814b
  Author: Michael G. Kazakov <mike.kazakov at gmail.com>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    M libcxx/include/__algorithm/pstl.h
    M libcxx/include/__pstl/backend_fwd.h
    M libcxx/include/__pstl/backends/default.h
    M libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp
    M libcxx/test/libcxx/algorithms/pstl.nodiscard.verify.cpp
    A libcxx/test/std/algorithms/alg.sorting/alg.lex.comparison/pstl.lexicographical_compare.pass.cpp
    A libcxx/test/std/algorithms/alg.sorting/alg.lex.comparison/pstl.lexicographical_compare_comp.pass.cpp
    M libcxx/test/std/algorithms/pstl.exception_handling.pass.cpp

  Log Message:
  -----------
  [libc++][pstl] Implementation of parallel std::lexicographical_compare() based on std::mismatch() (#212366)

This PR adds an implementation of parallel
`std::lexicographical_compare()` based on parallel `std::mismatch()`.

The implementation is close to a one-liner:
```c++
auto __res = _Mismatch()(__policy, __first1, __last1, __first2, __last2, [&](_Ref1 __lhs, _Ref2 __rhs) {
  return !__comp(__lhs, __rhs) && !__comp(__rhs, __lhs);
});
```

Included tests check that:
- Semantics of the iterator-only version is correct.
- Semantics of the predicated version is correct.
- The functions correctly SFINAE out when the first argument is not an
execution policy.
- The `noexcept` policy is followed.
- The `nodiscard` policy is followed.
- `static_assert` verifies iterators' categories.

Part of #99938.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list