This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
[range.take.overview]
# 25 Ranges library [[ranges]](./#ranges)
## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.take.overview)
### 25.7.10 Take view [[range.take]](range.take#overview)
#### 25.7.10.1 Overview [range.take.overview]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L5864)
take_view produces a view of the first N elements
from another view, or all the elements if the adapted
view contains fewer than N[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L5869)
The name views::take denotes a
range adaptor object ([[range.adaptor.object]](range.adaptor.object "25.7.2Range adaptor objects"))[.](#2.sentence-1)
Let E and F be expressions,
let T be remove_cvref_t<decltype((E))>, and
let D be range_difference_t<decltype((E))>[.](#2.sentence-2)
If decltype((F)) does not model[convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<D>,views::take(E, F) is ill-formed[.](#2.sentence-3)
Otherwise, the expression views::take(E, F) is expression-equivalent to:
- [(2.1)](#2.1)
If T is a specialization
of empty_view ([[range.empty.view]](range.empty.view "25.6.2.2Class template empty_­view")),
then ((void)F, *decay-copy*(E)),
except that the evaluations of E and F are indeterminately sequenced[.](#2.1.sentence-1)
- [(2.2)](#2.2)
Otherwise, if T models[random_access_range](range.refinements#concept:random_access_range "25.4.6Other range refinements[range.refinements]") and [sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]") and is a specialization ofspan ([[views.span]](views.span "23.7.2.2Class template span")),basic_string_view ([[string.view]](string.view "27.3String view classes")), orsubrange ([[range.subrange]](range.subrange "25.5.4Sub-ranges")),
thenU(ranges::begin(E),
ranges::begin(E) + std::min<D>(ranges::distance(E), F)),
except that E is evaluated only once,
where U is a type determined as follows:
* [(2.2.1)](#2.2.1)
if T is a specialization of span,
then U is span<typename T::element_type>;
* [(2.2.2)](#2.2.2)
otherwise, if T is a specialization of basic_string_view,
then U is T;
* [(2.2.3)](#2.2.3)
otherwise, T is a specialization of subrange, andU is subrange<iterator_t<T>>;
- [(2.3)](#2.3)
otherwise, if T is
a specialization of iota_view ([[range.iota.view]](range.iota.view "25.6.4.2Class template iota_­view"))
that models [random_access_range](range.refinements#concept:random_access_range "25.4.6Other range refinements[range.refinements]") and [sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]"),
theniota_view(*ranges::begin(E),*(ranges::begin(E) + std::min<D>(ranges::distance(E), F))),
except that E is evaluated only once[.](#2.3.sentence-1)
- [(2.4)](#2.4)
Otherwise, if T is
a specialization of repeat_view ([[range.repeat.view]](range.repeat.view "25.6.5.2Class template repeat_­view")):
* [(2.4.1)](#2.4.1)
if T models [sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]"),
thenviews::repeat(*E.*value_*, std::min<D>(ranges::distance(E), F)) except that E is evaluated only once;
* [(2.4.2)](#2.4.2)
otherwise, views::repeat(*E.*value_*, static_cast<D>(F))[.](#2.4.sentence-1)
- [(2.5)](#2.5)
Otherwise, take_view(E, F)[.](#2.5.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L5938)
[*Example [1](#example-1)*: vector<int> is{0,1,2,3,4,5,6,7,8,9};for (int i : is | views::take(5)) cout << i << ' '; // prints 0 1 2 3 4 — *end example*]

View File

@@ -0,0 +1,62 @@
[range.take.sentinel]
# 25 Ranges library [[ranges]](./#ranges)
## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.take.sentinel)
### 25.7.10 Take view [[range.take]](range.take#sentinel)
#### 25.7.10.3 Class template take_view::*sentinel* [range.take.sentinel]
[🔗](#lib:take_view::sentinel)
namespace std::ranges {template<[view](range.view#concept:view "25.4.5Views[range.view]") V>template<bool Const>class take_view<V>::*sentinel* {private:using *Base* = *maybe-const*<Const, V>; // *exposition only*template<bool OtherConst>using *CI* = counted_iterator<iterator_t<*maybe-const*<OtherConst, V>>>; // *exposition only* sentinel_t<*Base*> *end_* = sentinel_t<*Base*>(); // *exposition only*public:*sentinel*() = default; constexpr explicit *sentinel*(sentinel_t<*Base*> end); constexpr *sentinel*(*sentinel*<!Const> s)requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<sentinel_t<V>, sentinel_t<*Base*>>; constexpr sentinel_t<*Base*> base() const; friend constexpr bool operator==(const *CI*<Const>& y, const *sentinel*& x); template<bool OtherConst = !Const>requires [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<sentinel_t<*Base*>, iterator_t<*maybe-const*<OtherConst, V>>>friend constexpr bool operator==(const *CI*<OtherConst>& y, const *sentinel*& x); };}
[🔗](#lib:take_view::sentinel,constructor)
`constexpr explicit sentinel(sentinel_t<Base> end);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6118)
*Effects*: Initializes *end_* with end[.](#1.sentence-1)
[🔗](#lib:take_view::sentinel,constructor_)
`constexpr sentinel(sentinel<!Const> s)
requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<sentinel_t<V>, sentinel_t<Base>>;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6130)
*Effects*: Initializes *end_* with std::move(s.*end_*)[.](#2.sentence-1)
[🔗](#lib:base,take_view::sentinel)
`constexpr sentinel_t<Base> base() const;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6141)
*Effects*: Equivalent to: return *end_*;
[🔗](#lib:operator==,take_view::sentinel)
`friend constexpr bool operator==(const CI<Const>& y, const sentinel& x);
template<bool OtherConst = !Const>
requires [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
friend constexpr bool operator==(const CI<OtherConst>& y, const sentinel& x);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6156)
*Effects*: Equivalent to:return y.count() == 0 || y.base() == x.*end_*;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,107 @@
[range.take.while]
# 25 Ranges library [[ranges]](./#ranges)
## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.take.while)
### 25.7.11 Take while view [range.take.while]
#### [25.7.11.1](#overview) Overview [[range.take.while.overview]](range.take.while.overview)
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6166)
Given a unary predicate pred and a view r,take_while_view produces a view
of the range [ranges::begin(r), ranges::find_if_not(r, pred))[.](#overview-1.sentence-1)
[2](#overview-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6172)
The name views::take_while denotes
a range adaptor object ([[range.adaptor.object]](range.adaptor.object "25.7.2Range adaptor objects"))[.](#overview-2.sentence-1)
Given subexpressions E and F,
the expression views::take_while(E, F) is expression-equivalent to take_while_view(E, F)[.](#overview-2.sentence-2)
[3](#overview-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6180)
[*Example [1](#overview-example-1)*: auto input = istringstream{"0 1 2 3 4 5 6 7 8 9"};auto small = [](const auto x) noexcept { return x < 5; };auto small_ints = views::istream<int>(input) | views::take_while(small);for (const auto i : small_ints) { cout << i << ' '; // prints 0 1 2 3 4}auto i = 0;
input >> i;
cout << i; // prints 6 — *end example*]
#### [25.7.11.2](#view) Class template take_while_view [[range.take.while.view]](range.take.while.view)
[🔗](#lib:take_while_view)
namespace std::ranges {template<[view](range.view#concept:view "25.4.5Views[range.view]") V, class Pred>requires [input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]")<V> && is_object_v<Pred> &&[indirect_unary_predicate](indirectcallable.indirectinvocable#concept:indirect_unary_predicate "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<const Pred, iterator_t<V>>class take_while_view : public view_interface<take_while_view<V, Pred>> {// [[range.take.while.sentinel]](#sentinel "25.7.11.3Class template take_­while_­view::sentinel"), class template take_while_view::*sentinel*template<bool> class *sentinel*; // *exposition only* V *base_* = V(); // *exposition only**movable-box*<Pred> *pred_*; // *exposition only*public: take_while_view() requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12Concept default_­initializable[concept.default.init]")<V> && [default_initializable](concept.default.init#concept:default_initializable "18.4.12Concept default_­initializable[concept.default.init]")<Pred> = default; constexpr explicit take_while_view(V base, Pred pred); constexpr V base() const & requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14Concept copy_­constructible[concept.copyconstructible]")<V> { return *base_*; }constexpr V base() && { return std::move(*base_*); }constexpr const Pred& pred() const; constexpr auto begin() requires (![*simple-view*](range.utility.helpers#concept:simple-view "25.5.2Helper concepts[range.utility.helpers]")<V>){ return ranges::begin(*base_*); }constexpr auto begin() constrequires [range](range.range#concept:range "25.4.2Ranges[range.range]")<const V> &&[indirect_unary_predicate](indirectcallable.indirectinvocable#concept:indirect_unary_predicate "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<const Pred, iterator_t<const V>>{ return ranges::begin(*base_*); }constexpr auto end() requires (![*simple-view*](range.utility.helpers#concept:simple-view "25.5.2Helper concepts[range.utility.helpers]")<V>){ return *sentinel*<false>(ranges::end(*base_*), addressof(**pred_*)); }constexpr auto end() constrequires [range](range.range#concept:range "25.4.2Ranges[range.range]")<const V> &&[indirect_unary_predicate](indirectcallable.indirectinvocable#concept:indirect_unary_predicate "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<const Pred, iterator_t<const V>>{ return *sentinel*<true>(ranges::end(*base_*), addressof(**pred_*)); }}; template<class R, class Pred> take_while_view(R&&, Pred) -> take_while_view<views::all_t<R>, Pred>;}
[🔗](#lib:take_while_view,constructor)
`constexpr explicit take_while_view(V base, Pred pred);
`
[1](#view-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6250)
*Effects*: Initializes *base_* with std::move(base) and*pred_* with std::move(pred)[.](#view-1.sentence-1)
[🔗](#lib:pred,take_while_view)
`constexpr const Pred& pred() const;
`
[2](#view-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6262)
*Effects*: Equivalent to: return **pred_*;
#### [25.7.11.3](#sentinel) Class template take_while_view::*sentinel* [[range.take.while.sentinel]](range.take.while.sentinel)
[🔗](#lib:take_while_view::sentinel)
namespace std::ranges {template<[view](range.view#concept:view "25.4.5Views[range.view]") V, class Pred>requires [input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]")<V> && is_object_v<Pred> &&[indirect_unary_predicate](indirectcallable.indirectinvocable#concept:indirect_unary_predicate "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<const Pred, iterator_t<V>>template<bool Const>class take_while_view<V, Pred>::*sentinel* {using *Base* = *maybe-const*<Const, V>; // *exposition only* sentinel_t<*Base*> *end_* = sentinel_t<*Base*>(); // *exposition only*const Pred* *pred_* = nullptr; // *exposition only*public:*sentinel*() = default; constexpr explicit *sentinel*(sentinel_t<*Base*> end, const Pred* pred); constexpr *sentinel*(*sentinel*<!Const> s)requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<sentinel_t<V>, sentinel_t<*Base*>>; constexpr sentinel_t<*Base*> base() const { return *end_*; }friend constexpr bool operator==(const iterator_t<*Base*>& x, const *sentinel*& y); template<bool OtherConst = !Const>requires [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<sentinel_t<*Base*>, iterator_t<*maybe-const*<OtherConst, V>>>friend constexpr bool operator==(const iterator_t<*maybe-const*<OtherConst, V>>& x, const *sentinel*& y); };}
[🔗](#lib:take_while_view::sentinel,constructor)
`constexpr explicit sentinel(sentinel_t<Base> end, const Pred* pred);
`
[1](#sentinel-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6306)
*Effects*: Initializes *end_* with end and *pred_* with pred[.](#sentinel-1.sentence-1)
[🔗](#lib:take_while_view::sentinel,constructor_)
`constexpr sentinel(sentinel<!Const> s)
requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<sentinel_t<V>, sentinel_t<Base>>;
`
[2](#sentinel-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6318)
*Effects*: Initializes *end_* with std::move(s.*end_*) and*pred_* with s.*pred_*[.](#sentinel-2.sentence-1)
[🔗](#lib:operator==,take_while_view::sentinel)
`friend constexpr bool operator==(const iterator_t<Base>& x, const sentinel& y);
template<bool OtherConst = !Const>
requires [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
friend constexpr bool operator==(const iterator_t<maybe-const<OtherConst, V>>& x,
const sentinel& y);
`
[3](#sentinel-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6335)
*Effects*: Equivalent to:return y.*end_* == x || !invoke(*y.*pred_*, *x);

View File

@@ -0,0 +1,34 @@
[range.take.while.overview]
# 25 Ranges library [[ranges]](./#ranges)
## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.take.while.overview)
### 25.7.11 Take while view [[range.take.while]](range.take.while#overview)
#### 25.7.11.1 Overview [range.take.while.overview]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6166)
Given a unary predicate pred and a view r,take_while_view produces a view
of the range [ranges::begin(r), ranges::find_if_not(r, pred))[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6172)
The name views::take_while denotes
a range adaptor object ([[range.adaptor.object]](range.adaptor.object "25.7.2Range adaptor objects"))[.](#2.sentence-1)
Given subexpressions E and F,
the expression views::take_while(E, F) is expression-equivalent to take_while_view(E, F)[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6180)
[*Example [1](#example-1)*: auto input = istringstream{"0 1 2 3 4 5 6 7 8 9"};auto small = [](const auto x) noexcept { return x < 5; };auto small_ints = views::istream<int>(input) | views::take_while(small);for (const auto i : small_ints) { cout << i << ' '; // prints 0 1 2 3 4}auto i = 0;
input >> i;
cout << i; // prints 6 — *end example*]

View File

@@ -0,0 +1,52 @@
[range.take.while.sentinel]
# 25 Ranges library [[ranges]](./#ranges)
## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.take.while.sentinel)
### 25.7.11 Take while view [[range.take.while]](range.take.while#sentinel)
#### 25.7.11.3 Class template take_while_view::*sentinel* [range.take.while.sentinel]
[🔗](#lib:take_while_view::sentinel)
namespace std::ranges {template<[view](range.view#concept:view "25.4.5Views[range.view]") V, class Pred>requires [input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]")<V> && is_object_v<Pred> &&[indirect_unary_predicate](indirectcallable.indirectinvocable#concept:indirect_unary_predicate "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<const Pred, iterator_t<V>>template<bool Const>class take_while_view<V, Pred>::*sentinel* {using *Base* = *maybe-const*<Const, V>; // *exposition only* sentinel_t<*Base*> *end_* = sentinel_t<*Base*>(); // *exposition only*const Pred* *pred_* = nullptr; // *exposition only*public:*sentinel*() = default; constexpr explicit *sentinel*(sentinel_t<*Base*> end, const Pred* pred); constexpr *sentinel*(*sentinel*<!Const> s)requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<sentinel_t<V>, sentinel_t<*Base*>>; constexpr sentinel_t<*Base*> base() const { return *end_*; }friend constexpr bool operator==(const iterator_t<*Base*>& x, const *sentinel*& y); template<bool OtherConst = !Const>requires [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<sentinel_t<*Base*>, iterator_t<*maybe-const*<OtherConst, V>>>friend constexpr bool operator==(const iterator_t<*maybe-const*<OtherConst, V>>& x, const *sentinel*& y); };}
[🔗](#lib:take_while_view::sentinel,constructor)
`constexpr explicit sentinel(sentinel_t<Base> end, const Pred* pred);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6306)
*Effects*: Initializes *end_* with end and *pred_* with pred[.](#1.sentence-1)
[🔗](#lib:take_while_view::sentinel,constructor_)
`constexpr sentinel(sentinel<!Const> s)
requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<sentinel_t<V>, sentinel_t<Base>>;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6318)
*Effects*: Initializes *end_* with std::move(s.*end_*) and*pred_* with s.*pred_*[.](#2.sentence-1)
[🔗](#lib:operator==,take_while_view::sentinel)
`friend constexpr bool operator==(const iterator_t<Base>& x, const sentinel& y);
template<bool OtherConst = !Const>
requires [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
friend constexpr bool operator==(const iterator_t<maybe-const<OtherConst, V>>& x,
const sentinel& y);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6335)
*Effects*: Equivalent to:return y.*end_* == x || !invoke(*y.*pred_*, *x);

View File

@@ -0,0 +1,35 @@
[range.take.while.view]
# 25 Ranges library [[ranges]](./#ranges)
## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.take.while.view)
### 25.7.11 Take while view [[range.take.while]](range.take.while#view)
#### 25.7.11.2 Class template take_while_view [range.take.while.view]
[🔗](#lib:take_while_view)
namespace std::ranges {template<[view](range.view#concept:view "25.4.5Views[range.view]") V, class Pred>requires [input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]")<V> && is_object_v<Pred> &&[indirect_unary_predicate](indirectcallable.indirectinvocable#concept:indirect_unary_predicate "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<const Pred, iterator_t<V>>class take_while_view : public view_interface<take_while_view<V, Pred>> {// [[range.take.while.sentinel]](range.take.while.sentinel "25.7.11.3Class template take_­while_­view::sentinel"), class template take_while_view::*sentinel*template<bool> class *sentinel*; // *exposition only* V *base_* = V(); // *exposition only**movable-box*<Pred> *pred_*; // *exposition only*public: take_while_view() requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12Concept default_­initializable[concept.default.init]")<V> && [default_initializable](concept.default.init#concept:default_initializable "18.4.12Concept default_­initializable[concept.default.init]")<Pred> = default; constexpr explicit take_while_view(V base, Pred pred); constexpr V base() const & requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14Concept copy_­constructible[concept.copyconstructible]")<V> { return *base_*; }constexpr V base() && { return std::move(*base_*); }constexpr const Pred& pred() const; constexpr auto begin() requires (![*simple-view*](range.utility.helpers#concept:simple-view "25.5.2Helper concepts[range.utility.helpers]")<V>){ return ranges::begin(*base_*); }constexpr auto begin() constrequires [range](range.range#concept:range "25.4.2Ranges[range.range]")<const V> &&[indirect_unary_predicate](indirectcallable.indirectinvocable#concept:indirect_unary_predicate "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<const Pred, iterator_t<const V>>{ return ranges::begin(*base_*); }constexpr auto end() requires (![*simple-view*](range.utility.helpers#concept:simple-view "25.5.2Helper concepts[range.utility.helpers]")<V>){ return *sentinel*<false>(ranges::end(*base_*), addressof(**pred_*)); }constexpr auto end() constrequires [range](range.range#concept:range "25.4.2Ranges[range.range]")<const V> &&[indirect_unary_predicate](indirectcallable.indirectinvocable#concept:indirect_unary_predicate "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<const Pred, iterator_t<const V>>{ return *sentinel*<true>(ranges::end(*base_*), addressof(**pred_*)); }}; template<class R, class Pred> take_while_view(R&&, Pred) -> take_while_view<views::all_t<R>, Pred>;}
[🔗](#lib:take_while_view,constructor)
`constexpr explicit take_while_view(V base, Pred pred);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6250)
*Effects*: Initializes *base_* with std::move(base) and*pred_* with std::move(pred)[.](#1.sentence-1)
[🔗](#lib:pred,take_while_view)
`constexpr const Pred& pred() const;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L6262)
*Effects*: Equivalent to: return **pred_*;