From Jason Turner

[range.drop.while.view]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpcsn70i6a/{from.md → to.md} +60 -0
tmp/tmpcsn70i6a/{from.md → to.md} RENAMED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class template `drop_while_view` <a id="range.drop.while.view">[[range.drop.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 drop_while_view : public view_interface<drop_while_view<V, Pred>> {
9
+ public:
10
+ drop_while_view() = default;
11
+ constexpr drop_while_view(V base, Pred pred);
12
+
13
+ constexpr V base() const& requires copy_constructible<V> { return base_; }
14
+ constexpr V base() && { return std::move(base_); }
15
+
16
+ constexpr const Pred& pred() const;
17
+
18
+ constexpr auto begin();
19
+
20
+ constexpr auto end()
21
+ { return ranges::end(base_); }
22
+
23
+ private:
24
+ V base_ = V(); // exposition only
25
+ semiregular-box<Pred> pred_; // exposition only
26
+ };
27
+
28
+ template<class R, class Pred>
29
+ drop_while_view(R&&, Pred) -> drop_while_view<views::all_t<R>, Pred>;
30
+ }
31
+ ```
32
+
33
+ ``` cpp
34
+ constexpr drop_while_view(V base, Pred pred);
35
+ ```
36
+
37
+ *Effects:* Initializes *base\_* with `std::move(base)` and *pred\_* with
38
+ `std::move(pred)`.
39
+
40
+ ``` cpp
41
+ constexpr const Pred& pred() const;
42
+ ```
43
+
44
+ *Effects:* Equivalent to: `return *`*`pred_`*`;`
45
+
46
+ ``` cpp
47
+ constexpr auto begin();
48
+ ```
49
+
50
+ *Returns:* `ranges::find_if_not(base_, cref(*pred_))`.
51
+
52
+ *Remarks:* In order to provide the amortized constant-time complexity
53
+ required by the `range` concept when `drop_while_view` models
54
+ `forward_range`, the first call caches the result within the
55
+ `drop_while_view` for use on subsequent calls.
56
+
57
+ [*Note 1*: Without this, applying a `reverse_view` over a
58
+ `drop_while_view` would have quadratic iteration
59
+ complexity. — *end note*]
60
+