================
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_PSTL_BACKENDS_OPENMP_BACKEND_ANY_OF_H
+#define _LIBCPP___ALGORITHM_PSTL_BACKENDS_OPENMP_BACKEND_ANY_OF_H
+
+#include <__algorithm/any_of.h>
+#include <__algorithm/pstl_backends/cpu_backends/backend.h>
+#include <__algorithm/pstl_backends/openmp/backend.h>
+#include <__config>
+#include <__type_traits/is_execution_policy.h>
+
+#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
+_LIBCPP_HIDE_FROM_ABI bool
+__pstl_any_of(__omp_backend_tag, _ForwardIterator __first, _ForwardIterator 
__last, _Predicate __pred) {
----------------
ldionne wrote:

You should look at the updated documentation for backend functions in 
`libcxx/include/__algorithm/pstl_backend.h`. They now return `optional`.

The `optional`s are used to represent whether the implementation failed to run 
the algorithm due to a setup issue. For example in the CPU backends we 
sometimes need to allocate memory and that can fail. When that fails, we return 
an empty optional and the front-end of the PSTL will then throw 
`std::bad_alloc` for us.

In your case I think there's nothing that can throw or fail so far, so you 
should always return an engaged optional.

https://github.com/llvm/llvm-project/pull/66968
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to