File indexing completed on 2025-12-16 10:27:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef RANGES_V3_ALGORITHM_IS_PARTITIONED_HPP
0022 #define RANGES_V3_ALGORITHM_IS_PARTITIONED_HPP
0023
0024 #include <meta/meta.hpp>
0025
0026 #include <range/v3/range_fwd.hpp>
0027
0028 #include <range/v3/functional/identity.hpp>
0029 #include <range/v3/functional/invoke.hpp>
0030 #include <range/v3/iterator/concepts.hpp>
0031 #include <range/v3/iterator/traits.hpp>
0032 #include <range/v3/range/access.hpp>
0033 #include <range/v3/range/concepts.hpp>
0034 #include <range/v3/range/traits.hpp>
0035 #include <range/v3/utility/static_const.hpp>
0036
0037 #include <range/v3/detail/prologue.hpp>
0038
0039 namespace ranges
0040 {
0041
0042
0043 RANGES_FUNC_BEGIN(is_partitioned)
0044
0045
0046 template(typename I, typename S, typename C, typename P = identity)(
0047 requires input_iterator<I> AND sentinel_for<S, I> AND
0048 indirect_unary_predicate<C, projected<I, P>>)
0049 constexpr bool RANGES_FUNC(is_partitioned)(I first, S last, C pred, P proj = P{})
0050 {
0051 for(; first != last; ++first)
0052 if(!invoke(pred, invoke(proj, *first)))
0053 break;
0054 for(; first != last; ++first)
0055 if(invoke(pred, invoke(proj, *first)))
0056 return false;
0057 return true;
0058 }
0059
0060
0061 template(typename Rng, typename C, typename P = identity)(
0062 requires input_range<Rng> AND
0063 indirect_unary_predicate<C, projected<iterator_t<Rng>, P>>)
0064 constexpr bool RANGES_FUNC(is_partitioned)(Rng && rng, C pred, P proj = P{})
0065 {
0066 return (*this)(begin(rng), end(rng), std::move(pred), std::move(proj));
0067 }
0068
0069 RANGES_FUNC_END(is_partitioned)
0070
0071 namespace cpp20
0072 {
0073 using ranges::is_partitioned;
0074 }
0075
0076 }
0077
0078 #include <range/v3/detail/epilogue.hpp>
0079
0080 #endif