5 #ifndef VCCC_RANGES_VIEWS_SPLIT_VIEW_HPP
6 #define VCCC_RANGES_VIEWS_SPLIT_VIEW_HPP
46 template<
typename V,
typename Pattern>
49 struct check_range : std::false_type {};
51 struct check_range<R, true>
53 constructible_from<V, views::all_t<R>>,
54 constructible_from<Pattern, single_view<range_value_t<R>>>
75 #if __cplusplus < 202002L
91 return {cur_, next_.
begin()};
100 trailing_empty_ =
true;
101 next_ = {cur_, cur_};
106 trailing_empty_ =
false;
119 return x.cur_ == y.cur_ and x.trailing_empty_ == y.trailing_empty_;
130 bool trailing_empty_ =
false;
138 : end_(ranges::
end(parent.base_)) {}
142 return x.cur_ == y.end_ && !x.trailing_empty_;
164 : base_(
std::move(
base)), pattern_(
std::move(pattern)) {}
168 : base_(views::
all(
std::forward<R>(r)))
177 return std::move(base_);
182 if (!cached_begin_.has_value())
184 return {*
this,
first, *cached_begin_};
202 auto b = b_e.begin();
210 return {std::move(b), std::move(
e)};
216 non_propagating_cache<subrange<iterator_t<V>>> cached_begin_{};
222 struct same_with_range_value : std::false_type {};
223 template<
typename R,
typename POV>
224 struct same_with_range_value<R, POV, true> : same_as<range_value_t<R>, remove_cvref_t<POV>> {};
227 constexpr
auto make_split_view_impl(R&& r, range_value_t<R> patteern, std::true_type ) {
228 return split_view<views::all_t<R>, single_view<range_value_t<R>>>(std::forward<R>(r), std::move(patteern));
231 template<
typename R,
typename P>
232 constexpr
auto make_split_view_impl(R&& r, P&& pattern, std::false_type ) {
233 return split_view<views::all_t<R>, views::all_t<P>>(std::forward<R>(r), std::forward<P>(pattern));
238 template<
typename R,
typename P>
240 return detail::make_split_view_impl(
241 std::forward<R>(r), std::forward<P>(pattern), detail::same_with_range_value<R, P>{});
244 #if __cplusplus >= 201703L
246 template<
typename R,
typename P>
252 single_view<range_value_t<R>>,
#define VCCC_ADDRESSOF_CONSTEXPR
Definition: addressof.hpp:14
Definition: single.hpp:38
Definition: split_view.hpp:67
constexpr const iterator_t< V > base() const
Definition: split_view.hpp:85
VCCC_ADDRESSOF_CONSTEXPR iterator(split_view &parent, iterator_t< V > current, subrange< iterator_t< V >> next)
Definition: split_view.hpp:82
void pointer
Definition: split_view.hpp:76
constexpr friend bool operator!=(const iterator &x, const iterator &y)
Definition: split_view.hpp:122
constexpr value_type operator*() const
Definition: split_view.hpp:90
constexpr friend bool operator==(const iterator &x, const iterator &y)
Definition: split_view.hpp:118
input_iterator_tag iterator_category
Definition: split_view.hpp:72
forward_iterator_tag iterator_concept
Definition: split_view.hpp:71
subrange< iterator_t< V > > value_type
Definition: split_view.hpp:73
constexpr iterator operator++(int)
Definition: split_view.hpp:112
range_difference_t< V > difference_type
Definition: split_view.hpp:74
constexpr iterator & operator++()
Definition: split_view.hpp:94
Definition: split_view.hpp:133
constexpr sentinel(split_view &parent)
Definition: split_view.hpp:137
constexpr friend bool operator!=(const iterator &x, const sentinel &y)
Definition: split_view.hpp:145
constexpr friend bool operator==(const iterator &x, const sentinel &y)
Definition: split_view.hpp:140
constexpr friend bool operator==(const sentinel &y, const iterator &x)
Definition: split_view.hpp:149
constexpr friend bool operator!=(const sentinel &y, const iterator &x)
Definition: split_view.hpp:153
split_view takes a view and a delimiter, and splits the view into subranges on the delimiter.
Definition: split_view.hpp:47
constexpr V base() const &
Definition: split_view.hpp:172
constexpr iterator end()
Definition: split_view.hpp:188
constexpr split_view(V base, Pattern pattern)
Definition: split_view.hpp:163
constexpr sentinel end()
Definition: split_view.hpp:193
constexpr V base() &&
Definition: split_view.hpp:176
constexpr subrange< iterator_t< V > > find_next(iterator_t< V > it)
Definition: split_view.hpp:197
constexpr iterator begin()
Definition: split_view.hpp:180
constexpr split_view(R &&r, range_value_t< R > e)
Definition: split_view.hpp:167
constexpr S end() const
Definition: subrange.hpp:213
constexpr I begin() const
Definition: subrange.hpp:204
helper class template for defining a view, using the curiously recurring template pattern
Definition: view_interface.hpp:78
constexpr VCCC_INLINE_OR_STATIC detail::search_niebloid search
Definition: search.hpp:87
constexpr VCCC_INLINE_OR_STATIC detail::next_niebloid next
Definition: next.hpp:65
std::forward_iterator_tag forward_iterator_tag
Definition: iterator_tag.hpp:17
std::input_iterator_tag input_iterator_tag
Definition: iterator_tag.hpp:15
constexpr T e
the mathematical constant
Definition: constants.hpp:37
std::enable_if_t< std::is_object< T >::value, T * > addressof(T &t) noexcept
Definition: addressof.hpp:33
constexpr VCCC_INLINE_OR_STATIC detail::empty_niebloid empty
checks whether a range is empty
Definition: empty.hpp:116
constexpr auto make_split_view(R &&r, P &&pattern)
Definition: split_view.hpp:239
typename sentinel< R >::type sentinel_t
Definition: sentinel_t.hpp:29
typename ranges::iterator< T >::type iterator_t
Definition: iterator_t.hpp:32
constexpr VCCC_INLINE_OR_STATIC detail::begin_niebloid begin
returns an iterator to the beginning of a range
Definition: begin.hpp:116
typename detail::all_t_impl< R >::type all_t
Calculates the suitable view type of a viewable_range type.
Definition: all.hpp:107
constexpr VCCC_INLINE_OR_STATIC detail::end_niebloid end
returns a sentinel indicating the end of a range
Definition: end.hpp:120
typename range_difference< R >::type range_difference_t
Used to obtain the difference type of the iterator type of range type R.
Definition: range_difference_t.hpp:41
constexpr VCCC_INLINE_OR_STATIC detail::all_adaptor_closure all
a view that includes all elements of a range
Definition: all.hpp:82
typename range_value< R >::type range_value_t
Used to obtain the value type of the iterator type of range type R.
Definition: range_value_t.hpp:42
Definition: matrix.hpp:495
Definition: cxx20_rel_ops.hpp:17
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 0 > first
Definition: key_value.hpp:34
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
Definition: conjunction.hpp:22
specifies that the values referenced by two indirectly_readable types can be compared
Definition: indirectly_comparable.hpp:49
Definition: equal_to.hpp:20
specifies that a range is a view, that is, it has constant time copy/move/assignment
Definition: view.hpp:31