brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 7f0fd29 Raw
64 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_ANY_OF_H10#define _LIBCPP___ALGORITHM_RANGES_ANY_OF_H11 12#include <__algorithm/any_of.h>13#include <__config>14#include <__functional/identity.h>15#include <__iterator/concepts.h>16#include <__iterator/projected.h>17#include <__ranges/access.h>18#include <__ranges/concepts.h>19#include <__utility/move.h>20 21#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)22#  pragma GCC system_header23#endif24 25_LIBCPP_PUSH_MACROS26#include <__undef_macros>27 28#if _LIBCPP_STD_VER >= 2029 30_LIBCPP_BEGIN_NAMESPACE_STD31 32namespace ranges {33struct __any_of {34  template <input_iterator _Iter,35            sentinel_for<_Iter> _Sent,36            class _Proj = identity,37            indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>38  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool39  operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {40    return std::__any_of(std::move(__first), std::move(__last), __pred, __proj);41  }42 43  template <input_range _Range,44            class _Proj = identity,45            indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>46  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool47  operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {48    return std::__any_of(ranges::begin(__range), ranges::end(__range), __pred, __proj);49  }50};51 52inline namespace __cpo {53inline constexpr auto any_of = __any_of{};54} // namespace __cpo55} // namespace ranges56 57_LIBCPP_END_NAMESPACE_STD58 59#endif // _LIBCPP_STD_VER >= 2060 61_LIBCPP_POP_MACROS62 63#endif // _LIBCPP___ALGORITHM_RANGES_ANY_OF_H64