14#ifndef RANGES_V3_VIEW_CHUNK_BY_HPP
15#define RANGES_V3_VIEW_CHUNK_BY_HPP
33#include <range/v3/utility/static_const.hpp>
39#include <range/v3/detail/prologue.hpp>
46 template<
typename Rng,
typename Fun>
49 is_finite<Rng>::value ? finite : range_cardinality<Rng>::value>
55 detail::non_propagating_cache<iterator_t<Rng>> second_;
56 semiregular_box_t<Fun> fun_;
65 sentinel_t<Rng> last_;
66 semiregular_box_ref_or_val_t<Fun, false> fun_;
69 template<
typename I = iterator_t<Rng>>
72 return {cur_, next_cur_};
77 return {cur_, next_cur_};
83 auto partition_cur = adjacent_find(cur_, last_,
not_fn(fun_));
85 partition_cur != last_ ? ranges::next(partition_cur) : partition_cur;
92 bool equal(cursor
const & that)
const
94 return cur_ == that.cur_;
107 cursor begin_cursor()
109 auto first = ranges::begin(rng_);
110 auto last = ranges::end(rng_);
113 auto partition_cur = adjacent_find(
first, last,
not_fn(fun_));
115 partition_cur != last ? ranges::next(partition_cur) : partition_cur;
117 return {fun_,
first, *second_, last};
123 : rng_(std::move(rng))
124 , fun_(std::move(fun))
128#if RANGES_CXX_DEDUCTION_GUIDES >= RANGES_CXX_DEDUCTION_GUIDES_17
129 template(
typename Rng,
typename Fun)(
131 ->chunk_by_view<views::all_t<Rng>, Fun>;
138 template(
typename Rng,
typename Fun)(
142 operator()(Rng && rng, Fun fun)
const
144 return {all(
static_cast<Rng &&
>(rng)), std::move(fun)};
150 using chunk_by_base_fn::operator();
152 template<
typename Fun>
153 constexpr auto operator()(Fun fun)
const
166#include <range/v3/detail/epilogue.hpp>
167#include <range/v3/detail/satisfy_boost_range.hpp>
The forward_range concept.
The indirect_relation concept.
The viewable_range concept.
decltype(begin(declval(Rng &))) iterator_t
Definition: access.hpp:698
RANGES_INLINE_VARIABLE(detail::to_container_fn< detail::from_range< std::vector > >, to_vector) template< template< typename... > class ContT > auto to(RANGES_HIDDEN_DETAIL(detail
For initializing a container of the specified type with the elements of an Range.
Definition: conversion.hpp:399
defer< bind_back, Fn, Ts... > bind_back
Definition: meta.hpp:994
front< Pair > first
Retrieve the first element of the pair Pair.
Definition: meta.hpp:2251
compose< quote< not_ >, Fn > not_fn
Logically negate the result of invocable Fn.
Definition: meta.hpp:3009
Definition: chunk_by.hpp:50
Definition: default_sentinel.hpp:26
Definition: subrange.hpp:196
A utility for constructing a view from a (derived) type that implements begin and end cursors.
Definition: facade.hpp:66
Definition: chunk_by.hpp:137
Definition: chunk_by.hpp:149