65 lines · c
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef _LIBCPP___ALGORITHM_RANGES_ALL_OF_H10#define _LIBCPP___ALGORITHM_RANGES_ALL_OF_H11 12#include <__algorithm/all_of.h>13#include <__config>14#include <__functional/identity.h>15#include <__functional/invoke.h>16#include <__iterator/concepts.h>17#include <__iterator/projected.h>18#include <__ranges/access.h>19#include <__ranges/concepts.h>20#include <__utility/move.h>21 22#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)23# pragma GCC system_header24#endif25 26_LIBCPP_PUSH_MACROS27#include <__undef_macros>28 29#if _LIBCPP_STD_VER >= 2030 31_LIBCPP_BEGIN_NAMESPACE_STD32 33namespace ranges {34struct __all_of {35 template <input_iterator _Iter,36 sentinel_for<_Iter> _Sent,37 class _Proj = identity,38 indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>39 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool40 operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {41 return std::__all_of(std::move(__first), std::move(__last), __pred, __proj);42 }43 44 template <input_range _Range,45 class _Proj = identity,46 indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>47 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool48 operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {49 return std::__all_of(ranges::begin(__range), ranges::end(__range), __pred, __proj);50 }51};52 53inline namespace __cpo {54inline constexpr auto all_of = __all_of{};55} // namespace __cpo56} // namespace ranges57 58_LIBCPP_END_NAMESPACE_STD59 60#endif // _LIBCPP_STD_VER >= 2061 62_LIBCPP_POP_MACROS63 64#endif // _LIBCPP___ALGORITHM_RANGES_ALL_OF_H65