From Jason Turner

[range.take.while.view]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzh0ey1jt/{from.md → to.md} +54 -0
tmp/tmpzh0ey1jt/{from.md → to.md} RENAMED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class template `take_while_view` <a id="range.take.while.view">[[range.take.while.view]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::ranges {
5
+ template<view V, class Pred>
6
+ requires input_range<V> && is_object_v<Pred> &&
7
+ indirect_unary_predicate<const Pred, iterator_t<V>>
8
+ class take_while_view : public view_interface<take_while_view<V, Pred>> {
9
+ // [range.take.while.sentinel], class template take_while_view::sentinel
10
+ template<bool> class sentinel; // exposition only
11
+
12
+ V base_ = V(); // exposition only
13
+ semiregular-box<Pred> pred_; // exposition only
14
+
15
+ public:
16
+ take_while_view() = default;
17
+ constexpr take_while_view(V base, Pred pred);
18
+
19
+ constexpr V base() const& requires copy_constructible<V> { return base_; }
20
+ constexpr V base() && { return std::move(base_); }
21
+
22
+ constexpr const Pred& pred() const;
23
+
24
+ constexpr auto begin() requires (!simple-view<V>)
25
+ { return ranges::begin(base_); }
26
+
27
+ constexpr auto begin() const requires range<const V>
28
+ { return ranges::begin(base_); }
29
+
30
+ constexpr auto end() requires (!simple-view<V>)
31
+ { return sentinel<false>(ranges::end(base_), addressof(*pred_)); }
32
+
33
+ constexpr auto end() const requires range<const V>
34
+ { return sentinel<true>(ranges::end(base_), addressof(*pred_)); }
35
+ };
36
+
37
+ template<class R, class Pred>
38
+ take_while_view(R&&, Pred) -> take_while_view<views::all_t<R>, Pred>;
39
+ }
40
+ ```
41
+
42
+ ``` cpp
43
+ constexpr take_while_view(V base, Pred pred);
44
+ ```
45
+
46
+ *Effects:* Initializes *base\_* with `std::move(base)` and *pred\_* with
47
+ `std::move(pred)`.
48
+
49
+ ``` cpp
50
+ constexpr const Pred& pred() const;
51
+ ```
52
+
53
+ *Effects:* Equivalent to: `return *`*`pred_`*`;`
54
+