[libcxx-commits] [libcxx] [libc++][pstl] Default implementation of parallel std::adjacent_difference (PR #207585)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 8 08:48:27 PDT 2026


================
@@ -0,0 +1,171 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 ForwardIterator1,
+//           class ForwardIterator2>
+//   ForwardIterator2 adjacent_difference(ExecutionPolicy&& exec,
+//                                        ForwardIterator1 first1,
+//                                        ForwardIterator1 last1,
+//                                        ForwardIterator2 first2);
+
+#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"
+
+EXECUTION_POLICY_SFINAE_TEST(adjacent_difference);
+
+static_assert(sfinae_test_adjacent_difference<int, int*, int*, int*>);
+static_assert(!sfinae_test_adjacent_difference<std::execution::parallel_policy, int*, int*, int*>);
+
+template <class Callable>
+void runway_sample(size_t size, Callable callable) {
----------------
ldionne wrote:

This could live in `libcxx/test/support/runway_sample.h`. And then we'd want to add a comment explaining what this function does and what its purpose is.

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


More information about the libcxx-commits mailing list