aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/include/__algorithm/all_of.h
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-04-05 01:46:13 -0400
committerGitHub <noreply@github.com>2025-04-05 01:46:13 -0400
commit0cd31fc7ff157551cfbba5da35cd79f118d2a2e3 (patch)
treea308488f5d85184c8ec402fb3f55f1cf2704443e /lib/libcxx/include/__algorithm/all_of.h
parent8acedfd5baabab705946ad097746f9183ef62420 (diff)
parentcefe65c1b8abe65a22d4b68410db1be264fdeda0 (diff)
downloadzig-0cd31fc7ff157551cfbba5da35cd79f118d2a2e3.tar.gz
zig-0cd31fc7ff157551cfbba5da35cd79f118d2a2e3.zip
Merge pull request #22780 from ziglang/llvm20
LLVM 20
Diffstat (limited to 'lib/libcxx/include/__algorithm/all_of.h')
-rw-r--r--lib/libcxx/include/__algorithm/all_of.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/libcxx/include/__algorithm/all_of.h b/lib/libcxx/include/__algorithm/all_of.h
index ec84eea759..6acc117fc4 100644
--- a/lib/libcxx/include/__algorithm/all_of.h
+++ b/lib/libcxx/include/__algorithm/all_of.h
@@ -11,6 +11,8 @@
#define _LIBCPP___ALGORITHM_ALL_OF_H
#include <__config>
+#include <__functional/identity.h>
+#include <__type_traits/invoke.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -18,15 +20,23 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _InputIterator, class _Predicate>
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
- for (; __first != __last; ++__first)
- if (!__pred(*__first))
+template <class _Iter, class _Sent, class _Proj, class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+__all_of(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+ for (; __first != __last; ++__first) {
+ if (!std::__invoke(__pred, std::__invoke(__proj, *__first)))
return false;
+ }
return true;
}
+template <class _InputIterator, class _Predicate>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
+ __identity __proj;
+ return std::__all_of(__first, __last, __pred, __proj);
+}
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___ALGORITHM_ALL_OF_H