tmp/tmp4gfn0pz_/{from.md → to.md}
RENAMED
|
@@ -5,20 +5,21 @@ namespace std::ranges {
|
|
| 5 |
template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
|
| 6 |
requires view<V> && is_object_v<Pred>
|
| 7 |
class filter_view : public view_interface<filter_view<V, Pred>> {
|
| 8 |
private:
|
| 9 |
V base_ = V(); // exposition only
|
| 10 |
-
|
| 11 |
|
| 12 |
// [range.filter.iterator], class filter_view::iterator
|
| 13 |
class iterator; // exposition only
|
|
|
|
| 14 |
// [range.filter.sentinel], class filter_view::sentinel
|
| 15 |
class sentinel; // exposition only
|
| 16 |
|
| 17 |
public:
|
| 18 |
-
filter_view() = default;
|
| 19 |
-
constexpr filter_view(V base, Pred pred);
|
| 20 |
|
| 21 |
constexpr V base() const & requires copy_constructible<V> { return base_; }
|
| 22 |
constexpr V base() && { return std::move(base_); }
|
| 23 |
|
| 24 |
constexpr const Pred& pred() const;
|
|
@@ -36,11 +37,11 @@ namespace std::ranges {
|
|
| 36 |
filter_view(R&&, Pred) -> filter_view<views::all_t<R>, Pred>;
|
| 37 |
}
|
| 38 |
```
|
| 39 |
|
| 40 |
``` cpp
|
| 41 |
-
constexpr filter_view(V base, Pred pred);
|
| 42 |
```
|
| 43 |
|
| 44 |
*Effects:* Initializes *base\_* with `std::move(base)` and initializes
|
| 45 |
*pred\_* with `std::move(pred)`.
|
| 46 |
|
|
@@ -52,11 +53,11 @@ constexpr const Pred& pred() const;
|
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
constexpr iterator begin();
|
| 55 |
```
|
| 56 |
|
| 57 |
-
*Preconditions:* `pred_.has_value()`.
|
| 58 |
|
| 59 |
*Returns:* `{*this, ranges::find_if(`*`base_`*`, ref(*`*`pred_`*`))}`.
|
| 60 |
|
| 61 |
*Remarks:* In order to provide the amortized constant time complexity
|
| 62 |
required by the `range` concept when `filter_view` models
|
|
|
|
| 5 |
template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
|
| 6 |
requires view<V> && is_object_v<Pred>
|
| 7 |
class filter_view : public view_interface<filter_view<V, Pred>> {
|
| 8 |
private:
|
| 9 |
V base_ = V(); // exposition only
|
| 10 |
+
movable-box<Pred> pred_; // exposition only
|
| 11 |
|
| 12 |
// [range.filter.iterator], class filter_view::iterator
|
| 13 |
class iterator; // exposition only
|
| 14 |
+
|
| 15 |
// [range.filter.sentinel], class filter_view::sentinel
|
| 16 |
class sentinel; // exposition only
|
| 17 |
|
| 18 |
public:
|
| 19 |
+
filter_view() requires default_initializable<V> && default_initializable<Pred> = default;
|
| 20 |
+
constexpr explicit filter_view(V base, Pred pred);
|
| 21 |
|
| 22 |
constexpr V base() const & requires copy_constructible<V> { return base_; }
|
| 23 |
constexpr V base() && { return std::move(base_); }
|
| 24 |
|
| 25 |
constexpr const Pred& pred() const;
|
|
|
|
| 37 |
filter_view(R&&, Pred) -> filter_view<views::all_t<R>, Pred>;
|
| 38 |
}
|
| 39 |
```
|
| 40 |
|
| 41 |
``` cpp
|
| 42 |
+
constexpr explicit filter_view(V base, Pred pred);
|
| 43 |
```
|
| 44 |
|
| 45 |
*Effects:* Initializes *base\_* with `std::move(base)` and initializes
|
| 46 |
*pred\_* with `std::move(pred)`.
|
| 47 |
|
|
|
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
constexpr iterator begin();
|
| 56 |
```
|
| 57 |
|
| 58 |
+
*Preconditions:* *`pred_`*`.has_value()` is `true`.
|
| 59 |
|
| 60 |
*Returns:* `{*this, ranges::find_if(`*`base_`*`, ref(*`*`pred_`*`))}`.
|
| 61 |
|
| 62 |
*Remarks:* In order to provide the amortized constant time complexity
|
| 63 |
required by the `range` concept when `filter_view` models
|