[libcxx-commits] [libcxx] [libc++][pstl] Implementation of parallel std::is_heap() based on std::is_heap_until() (PR #221556)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 6 06:22:02 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Michael G. Kazakov (mikekazakov)

<details>
<summary>Changes</summary>

This PR adds a "one-liner" implementation of a parallel `std::is_heap()` based on `std::is_heap_until()`.

The implementation is effectively a call to `std::is_heap_until()` and a comparison with the last iterator:
```c++
auto res = IsHeapUntil()(policy, first, last, comp);
if (!res) {
    return nullopt;
}
return *res == last;
```

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

Part of #<!-- -->99938.

---

Patch is 87.44 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/221556.diff


9 Files Affected:

- (modified) libcxx/include/__algorithm/pstl.h (+25) 
- (modified) libcxx/include/__pstl/backend_fwd.h (+8-1) 
- (modified) libcxx/include/__pstl/backends/default.h (+15-1) 
- (modified) libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp (+5) 
- (modified) libcxx/test/libcxx/algorithms/pstl.nodiscard.verify.cpp (+4) 
- (added) libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/pstl.is_heap.pass.cpp (+1064) 
- (added) libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/pstl.is_heap_comp.pass.cpp (+1067) 
- (modified) libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/pstl.is_heap_until_comp.pass.cpp (+2-2) 
- (modified) libcxx/test/std/algorithms/pstl.exception_handling.pass.cpp (+6) 


``````````diff
diff --git a/libcxx/include/__algorithm/pstl.h b/libcxx/include/__algorithm/pstl.h
index 14b81ed0ade4f..9b4de5de5d36f 100644
--- a/libcxx/include/__algorithm/pstl.h
+++ b/libcxx/include/__algorithm/pstl.h
@@ -1086,6 +1086,31 @@ _LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
       std::move(__op));
 }
 
+template <class _ExecutionPolicy,
+          class _RandomAccessIterator,
+          class _RawPolicy                                    = __remove_cvref_t<_ExecutionPolicy>,
+          enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
+is_heap(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last) {
+  _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "is_heap requires RandomAccessIterators");
+  using _Implementation = __pstl::__dispatch<__pstl::__is_heap, __pstl::__current_configuration, _RawPolicy>;
+  return __pstl::__handle_exception<_Implementation>(
+      std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), less{});
+}
+
+template <class _ExecutionPolicy,
+          class _RandomAccessIterator,
+          class _Comp,
+          class _RawPolicy                                    = __remove_cvref_t<_ExecutionPolicy>,
+          enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
+is_heap(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
+  _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "is_heap requires RandomAccessIterators");
+  using _Implementation = __pstl::__dispatch<__pstl::__is_heap, __pstl::__current_configuration, _RawPolicy>;
+  return __pstl::__handle_exception<_Implementation>(
+      std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__comp));
+}
+
 template <class _ExecutionPolicy,
           class _RandomAccessIterator,
           class _RawPolicy                                    = __remove_cvref_t<_ExecutionPolicy>,
diff --git a/libcxx/include/__pstl/backend_fwd.h b/libcxx/include/__pstl/backend_fwd.h
index bec595449b40c..bd8ea25f4f70b 100644
--- a/libcxx/include/__pstl/backend_fwd.h
+++ b/libcxx/include/__pstl/backend_fwd.h
@@ -351,12 +351,19 @@ struct __reduce;
 //                       _Tp __init, _BinaryOperation __op) const noexcept;
 
 template <class _Backend, class _ExecutionPolicy>
-struct __is_heap_until;
+struct __is_heap;
 // template <class _Policy, class _RandomAccessIterator, class _Comp>
 // optional<bool>
 // operator()(_Policy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last,
 //                                _Comp __comp) const noexcept;
 
+template <class _Backend, class _ExecutionPolicy>
+struct __is_heap_until;
+// template <class _Policy, class _RandomAccessIterator, class _Comp>
+// optional<_RandomAccessIterator>
+// operator()(_Policy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last,
+//                                _Comp __comp) const noexcept;
+
 template <class _Backend, class _ExecutionPolicy>
 struct __is_sorted;
 // template <class _Policy, class _ForwardIterator, class _Comp>
diff --git a/libcxx/include/__pstl/backends/default.h b/libcxx/include/__pstl/backends/default.h
index e63c3802538de..a26d29b5d81db 100644
--- a/libcxx/include/__pstl/backends/default.h
+++ b/libcxx/include/__pstl/backends/default.h
@@ -66,7 +66,7 @@ namespace __pstl {
 //
 // is_heap_until family
 // --------------
-// No other algorithms based on is_heap_until
+// - is_heap
 //
 // find_if family
 // --------------
@@ -379,6 +379,20 @@ struct __adjacent_find<__default_backend_tag, _ExecutionPolicy> {
   }
 };
 
+template <class _ExecutionPolicy>
+struct __is_heap<__default_backend_tag, _ExecutionPolicy> {
+  template <class _Policy, class _RandomAccessIterator, class _Comp>
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool> operator()(
+      _Policy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp&& __comp) const noexcept {
+    using _IsHeapUntil = __dispatch<__is_heap_until, __current_configuration, _ExecutionPolicy>;
+    auto __res         = _IsHeapUntil()(__policy, std::move(__first), __last, std::forward<_Comp>(__comp));
+    if (!__res) {
+      return nullopt; // Failed to run the algorithm, propagate the error.
+    }
+    return *__res == __last; // is_heap_until returns the last iterator when no heap violations are found in the range.
+  }
+};
+
 template <class _ExecutionPolicy>
 struct __is_sorted_until<__default_backend_tag, _ExecutionPolicy> {
   template <class _Policy, class _ForwardIterator, class _Comp>
diff --git a/libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp b/libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp
index d67770cedc944..5bc435dfb9103 100644
--- a/libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp
+++ b/libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp
@@ -157,6 +157,11 @@ void f(non_forward_iterator non_fwd,
         pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: is_partitioned}}
   }
 
+  {
+    (void)std::is_heap(pol, non_random, non_random);       // expected-error@*:* {{static assertion failed: is_heap}}
+    (void)std::is_heap(pol, non_random, non_random, pred); // expected-error@*:* {{static assertion failed: is_heap}}
+  }
+
   {
     (void)std::is_heap_until(
         pol, non_random, non_random); // expected-error@*:* {{static assertion failed: is_heap_until}}
diff --git a/libcxx/test/libcxx/algorithms/pstl.nodiscard.verify.cpp b/libcxx/test/libcxx/algorithms/pstl.nodiscard.verify.cpp
index 1dbb100792d4e..55f2a1f93376e 100644
--- a/libcxx/test/libcxx/algorithms/pstl.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/algorithms/pstl.nodiscard.verify.cpp
@@ -56,6 +56,10 @@ void test() {
   // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
   std::find_first_of(std::execution::par, std::begin(a), std::end(a), std::begin(b), std::end(b), pred2);
   // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+  std::is_heap(std::execution::par, std::begin(a), std::end(a));
+  // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+  std::is_heap(std::execution::par, std::begin(a), std::end(a), pred2);
+  // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
   std::is_heap_until(std::execution::par, std::begin(a), std::end(a));
   // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
   std::is_heap_until(std::execution::par, std::begin(a), std::end(a), pred2);
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/pstl.is_heap.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/pstl.is_heap.pass.cpp
new file mode 100644
index 0000000000000..246ba22dc9f0a
--- /dev/null
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/pstl.is_heap.pass.cpp
@@ -0,0 +1,1064 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <algorithm>
+
+// template<class ExecutionPolicy, class RandomAccessIterator>
+//   bool
+//   is_heap(ExecutionPolicy&& exec,
+//           RandomAccessIterator first, RandomAccessIterator last);
+
+#include <cstddef>
+#include <algorithm>
+#include <cassert>
+#include <iterator>
+#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_heap);
+
+static_assert(sfinae_test_is_heap<int, int*, int*>);
+static_assert(!sfinae_test_is_heap<std::execution::parallel_policy, int*, int*>);
+
+template <class Iter>
+struct Test {
+  template <class ExecutionPolicy>
+  void operator()(ExecutionPolicy&& policy) {
+    { // Check the return type
+      int a[]  = {0};
+      auto res = std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a)));
+      static_assert(std::is_same_v<decltype(res), bool>);
+    }
+    { // Empty
+      int a[] = {0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::begin(a))));
+    }
+    { // Single
+      int a[] = {0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=2, heap
+      int a[] = {0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=2, not heap
+      int a[] = {0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=2, heap
+      int a[] = {1, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=3, heap
+      int a[] = {0, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=3, not heap
+      int a[] = {0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=3, not heap
+      int a[] = {0, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=3, not heap
+      int a[] = {0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=3, heap
+      int a[] = {1, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=3, heap
+      int a[] = {1, 0, 1};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=3, heap
+      int a[] = {1, 1, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, heap
+      int a[] = {0, 0, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {0, 0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {0, 0, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {0, 0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {0, 1, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {0, 1, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {0, 1, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {0, 1, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, heap
+      int a[] = {1, 0, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {1, 0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, heap
+      int a[] = {1, 0, 1, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, not heap
+      int a[] = {1, 0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, heap
+      int a[] = {1, 1, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, heap
+      int a[] = {1, 1, 0, 1};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=4, heap
+      int a[] = {1, 1, 1, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {0, 0, 0, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 0, 0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 0, 0, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 0, 0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 0, 1, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 0, 1, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 0, 1, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 0, 1, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 1, 0, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 1, 0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 1, 0, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 1, 0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 1, 1, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 1, 1, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 1, 1, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {0, 1, 1, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 0, 0, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {1, 0, 0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {1, 0, 0, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {1, 0, 0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 0, 1, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {1, 0, 1, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {1, 0, 1, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, not heap
+      int a[] = {1, 0, 1, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 1, 0, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 1, 0, 0, 1};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 1, 0, 1, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 1, 0, 1, 1};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 1, 1, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 1, 1, 0, 1};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=5, heap
+      int a[] = {1, 1, 1, 1, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, heap
+      int a[] = {0, 0, 0, 0, 0, 0};
+      assert(std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 0, 0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 0, 0, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 0, 0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 0, 1, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 0, 1, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 0, 1, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 0, 1, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 1, 0, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 1, 0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 1, 0, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 1, 0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 1, 1, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 1, 1, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 1, 1, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 0, 1, 1, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 0, 0, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 0, 0, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 0, 0, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 0, 0, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 0, 1, 0, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 0, 1, 0, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 0, 1, 1, 0};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 0, 1, 1, 1};
+      assert(!std::is_heap(policy, Iter(std::begin(a)), Iter(std::end(a))));
+    }
+    { // Size=6, not heap
+      int a[] = {0, 1, 1, 0, 0, 0};
...
[truncated]

``````````

</details>


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


More information about the libcxx-commits mailing list