[libcxx-commits] [libcxx] [libc++][pstl] Implementation of parallel std::is_sorted_until() based on std::adjacent_find() (PR #213445)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 3 06:28:39 PDT 2026


================
@@ -0,0 +1,247 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++17
+
+// UNSUPPORTED: libcpp-has-no-incomplete-pstl
+
+// template<class ExecutionPolicy, class ForwardIterator>
+// ForwardIterator is_sorted_until(ExecutionPolicy&& exec,
+//                                 ForwardIterator first, ForwardIterator last);
+
+#include <algorithm>
+#include <cassert>
+#include <functional>
+#include <iterator>
+#include <limits>
+#include <numeric>
+
+#include "test_execution_policies.h"
+#include "test_iterators.h"
+#include "test_macros.h"
+#include "type_algorithms.h"
+#include "runway_sample.h"
+
+EXECUTION_POLICY_SFINAE_TEST(is_sorted_until);
+
+static_assert(sfinae_test_is_sorted_until<int, int*, int*>);
+static_assert(!sfinae_test_is_sorted_until<std::execution::parallel_policy, int*, int*>);
+
+// The type X is provided to test that the is_sorted_until algorithm can be used with custom non-movable/non-copyable types.
+struct X {
----------------
Zingam wrote:

FYI: It is common in the test suite to encode this type of information in the name of the type, instead of comment, which makes tests easier to read IMO (for example see test/std/ranges), e.g:

```suggestion
struct NonMovableNonCopiable {
```

etc...

https://github.com/llvm/llvm-project/pull/213445


More information about the libcxx-commits mailing list