From Jason Turner

[range.adjacent.transform]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpaqrbw8ah/{from.md → to.md} +16 -7
tmp/tmpaqrbw8ah/{from.md → to.md} RENAMED
@@ -10,13 +10,14 @@ resulting view is empty.
10
 
11
  The name `views::adjacent_transform<N>` denotes a range adaptor object
12
  [[range.adaptor.object]]. Given subexpressions `E` and `F` and a
13
  constant expression `N`:
14
 
15
- - If `N` is equal to `0`, `views::adjacent_transform<N>(E, F)` is
16
- expression-equivalent to `((void)E, views::zip_transform(F))`, except
17
- that the evaluations of `E` and `F` are indeterminately sequenced.
 
18
  - Otherwise, the expression `views::adjacent_transform<N>(E, F)` is
19
  expression-equivalent to
20
  `adjacent_transform_view<views::all_t<decltype((E))>, decay_t<decltype((F))>, N>(E, F)`.
21
 
22
  [*Example 1*:
@@ -57,11 +58,11 @@ namespace std::ranges {
57
 
58
  public:
59
  adjacent_transform_view() = default;
60
  constexpr explicit adjacent_transform_view(V base, F fun);
61
 
62
- constexpr V base() const & requires copy_constructible<InnerView> { return inner_.base(); }
63
  constexpr V base() && { return std::move(inner_).base(); }
64
 
65
  constexpr auto begin() {
66
  return iterator<false>(*this, inner_.begin());
67
  }
@@ -95,10 +96,18 @@ namespace std::ranges {
95
  }
96
 
97
  constexpr auto size() const requires sized_range<const InnerView> {
98
  return inner_.size();
99
  }
 
 
 
 
 
 
 
 
100
  };
101
  }
102
  ```
103
 
104
  ``` cpp
@@ -125,11 +134,11 @@ namespace std::ranges {
125
 
126
  constexpr iterator(Parent& parent, inner-iterator<Const> inner); // exposition only
127
 
128
  public:
129
  using iterator_category = see below;
130
- using iterator_concept = typename inner-iterator<Const>::iterator_concept;
131
  using value_type =
132
  remove_cvref_t<invoke_result_t<maybe-const<Const, F>&,
133
  REPEAT(range_reference_t<Base>, N)...>>;
134
  using difference_type = range_difference_t<Base>;
135
 
@@ -399,11 +408,11 @@ constexpr sentinel(sentinel<!Const> i)
399
  template<bool OtherConst>
400
  requires sentinel_for<inner-sentinel<Const>, inner-iterator<OtherConst>>
401
  friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
402
  ```
403
 
404
- *Effects:* Equivalent to `return x.`*`inner_`*` == y.`*`inner_`*`;`
405
 
406
  ``` cpp
407
  template<bool OtherConst>
408
  requires sized_sentinel_for<inner-sentinel<Const>, inner-iterator<OtherConst>>
409
  friend constexpr range_difference_t<maybe-const<OtherConst, InnerView>>
@@ -413,7 +422,7 @@ template<bool OtherConst>
413
  requires sized_sentinel_for<inner-sentinel<Const>, inner-iterator<OtherConst>>
414
  friend constexpr range_difference_t<maybe-const<OtherConst, InnerView>>
415
  operator-(const sentinel& x, const iterator<OtherConst>& y);
416
  ```
417
 
418
- *Effects:* Equivalent to `return x.`*`inner_`*` - y.`*`inner_`*`;`
419
 
 
10
 
11
  The name `views::adjacent_transform<N>` denotes a range adaptor object
12
  [[range.adaptor.object]]. Given subexpressions `E` and `F` and a
13
  constant expression `N`:
14
 
15
+ - If `N` is equal to `0` and `decltype((E))` models `forward_range`,
16
+ `views::adjacent_transform<N>(E, F)` is expression-equivalent to
17
+ `((void)E, views::zip_transform(F))`, except that the evaluations of
18
+ `E` and `F` are indeterminately sequenced.
19
  - Otherwise, the expression `views::adjacent_transform<N>(E, F)` is
20
  expression-equivalent to
21
  `adjacent_transform_view<views::all_t<decltype((E))>, decay_t<decltype((F))>, N>(E, F)`.
22
 
23
  [*Example 1*:
 
58
 
59
  public:
60
  adjacent_transform_view() = default;
61
  constexpr explicit adjacent_transform_view(V base, F fun);
62
 
63
+ constexpr V base() const & requires copy_constructible<V> { return inner_.base(); }
64
  constexpr V base() && { return std::move(inner_).base(); }
65
 
66
  constexpr auto begin() {
67
  return iterator<false>(*this, inner_.begin());
68
  }
 
96
  }
97
 
98
  constexpr auto size() const requires sized_range<const InnerView> {
99
  return inner_.size();
100
  }
101
+
102
+ constexpr auto reserve_hint() requires approximately_sized_range<InnerView> {
103
+ return inner_.reserve_hint();
104
+ }
105
+
106
+ constexpr auto reserve_hint() const requires approximately_sized_range<const InnerView> {
107
+ return inner_.reserve_hint();
108
+ }
109
  };
110
  }
111
  ```
112
 
113
  ``` cpp
 
134
 
135
  constexpr iterator(Parent& parent, inner-iterator<Const> inner); // exposition only
136
 
137
  public:
138
  using iterator_category = see below;
139
+ using iterator_concept = inner-iterator<Const>::iterator_concept;
140
  using value_type =
141
  remove_cvref_t<invoke_result_t<maybe-const<Const, F>&,
142
  REPEAT(range_reference_t<Base>, N)...>>;
143
  using difference_type = range_difference_t<Base>;
144
 
 
408
  template<bool OtherConst>
409
  requires sentinel_for<inner-sentinel<Const>, inner-iterator<OtherConst>>
410
  friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
411
  ```
412
 
413
+ *Effects:* Equivalent to: `return x.`*`inner_`*` == y.`*`inner_`*`;`
414
 
415
  ``` cpp
416
  template<bool OtherConst>
417
  requires sized_sentinel_for<inner-sentinel<Const>, inner-iterator<OtherConst>>
418
  friend constexpr range_difference_t<maybe-const<OtherConst, InnerView>>
 
422
  requires sized_sentinel_for<inner-sentinel<Const>, inner-iterator<OtherConst>>
423
  friend constexpr range_difference_t<maybe-const<OtherConst, InnerView>>
424
  operator-(const sentinel& x, const iterator<OtherConst>& y);
425
  ```
426
 
427
+ *Effects:* Equivalent to: `return x.`*`inner_`*` - y.`*`inner_`*`;`
428