Path: blob/main/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h
35233 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef _LIBCPP___ALGORITHM_IS_PARTITIONED_H9#define _LIBCPP___ALGORITHM_IS_PARTITIONED_H1011#include <__config>1213#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)14# pragma GCC system_header15#endif1617_LIBCPP_BEGIN_NAMESPACE_STD1819template <class _InputIterator, class _Predicate>20_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool21is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) {22for (; __first != __last; ++__first)23if (!__pred(*__first))24break;25if (__first == __last)26return true;27++__first;28for (; __first != __last; ++__first)29if (__pred(*__first))30return false;31return true;32}3334_LIBCPP_END_NAMESPACE_STD3536#endif // _LIBCPP___ALGORITHM_IS_PARTITIONED_H373839