[range.lazy.split.view]

# 25 Ranges library [[ranges]](./#ranges)

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.lazy.split.view)

### 25.7.16 Lazy split view [[range.lazy.split]](range.lazy.split#view)

#### 25.7.16.2 Class template lazy_split_view [range.lazy.split.view]

[ð](#lib:lazy_split_view)

namespace std::ranges {template<auto> struct *require-constant*; // *exposition only*template<class R>concept [*tiny-range*](#concept:tiny-range "25.7.16.2 Class template lazy_­split_­view [range.lazy.split.view]") = // *exposition only*[sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R> &&requires { typename *require-constant*<remove_reference_t<R>::size()>; } &&(remove_reference_t<R>::size() <= 1); template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") V, [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]") Pattern>requires [view](range.view#concept:view "25.4.5 Views [range.view]")<V> && [view](range.view#concept:view "25.4.5 Views [range.view]")<Pattern> &&[indirectly_comparable](alg.req.ind.cmp#concept:indirectly_comparable "24.3.7.5 Concept indirectly_­comparable [alg.req.ind.cmp]")<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> &&([forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<V> || [*tiny-range*](#concept:tiny-range "25.7.16.2 Class template lazy_­split_­view [range.lazy.split.view]")<Pattern>)class lazy_split_view : public view_interface<lazy_split_view<V, Pattern>> {private: V *base_* = V(); // *exposition only* Pattern *pattern_* = Pattern(); // *exposition only**non-propagating-cache*<iterator_t<V>> *current_*; // *exposition only*, present only// if [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<V> is false// [[range.lazy.split.outer]](range.lazy.split.outer "25.7.16.3 Class template lazy_­split_­view​::​outer-iterator"), class template lazy_split_view​::​*outer-iterator*template<bool> struct *outer-iterator*; // *exposition only*// [[range.lazy.split.inner]](range.lazy.split.inner "25.7.16.5 Class template lazy_­split_­view​::​inner-iterator"), class template lazy_split_view​::​*inner-iterator*template<bool> struct *inner-iterator*; // *exposition only*public: lazy_split_view()requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<V> && [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<Pattern> = default; constexpr explicit lazy_split_view(V base, Pattern pattern); template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") R>requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<V, views::all_t<R>> &&[constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<Pattern, single_view<range_value_t<R>>>constexpr explicit lazy_split_view(R&& r, range_value_t<R> e); constexpr V base() const & requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_­constructible [concept.copyconstructible]")<V> { return *base_*; }constexpr V base() && { return std::move(*base_*); }constexpr auto begin() {if constexpr ([forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<V>) {return *outer-iterator*<[*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V> && [*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<Pattern>>{*this, ranges::begin(*base_*)}; } else {*current_* = ranges::begin(*base_*); return *outer-iterator*<false>{*this}; }}constexpr auto begin() const requires [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<V> && [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<const V> {return *outer-iterator*<true>{*this, ranges::begin(*base_*)}; }constexpr auto end() requires [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<V> && [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<V> {return *outer-iterator*<[*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V> && [*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<Pattern>>{*this, ranges::end(*base_*)}; }constexpr auto end() const {if constexpr ([forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<V> && [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<const V> && [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<const V>)return *outer-iterator*<true>{*this, ranges::end(*base_*)}; elsereturn default_sentinel; }}; template<class R, class P> lazy_split_view(R&&, P&&) -> lazy_split_view<views::all_t<R>, views::all_t<P>>; template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") R> lazy_split_view(R&&, range_value_t<R>)-> lazy_split_view<views::all_t<R>, single_view<range_value_t<R>>>;}

[ð](#lib:lazy_split_view,constructor)

`constexpr explicit lazy_split_view(V base, Pattern pattern);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L7935)

*Effects*: Initializes *base_* with std​::​move(base), and*pattern_* with std​::​move(pattern)[.](#1.sentence-1)

[ð](#lib:lazy_split_view,constructor_)

`template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") R>
  requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<V, views::all_t<R>> &&
           [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<Pattern, single_view<range_value_t<R>>>
constexpr explicit lazy_split_view(R&& r, range_value_t<R> e);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L7950)

*Effects*: Initializes *base_* with views​::​all(std​::​forward<R>(r)), and*pattern_* with views​::​single(std​::​move(e))[.](#2.sentence-1)
