From Jason Turner

[range.subrange.access]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp942ho2sv/{from.md → to.md} +11 -10
tmp/tmp942ho2sv/{from.md → to.md} RENAMED
@@ -76,28 +76,29 @@ return tmp;
76
  constexpr subrange& advance(iter_difference_t<I> n);
77
  ```
78
 
79
  *Effects:* Equivalent to:
80
 
81
- - If *StoreSize* is `true`,
82
  ``` cpp
 
 
 
 
 
 
 
 
 
83
  auto d = n - ranges::advance(begin_, n, end_);
84
- if (d >= 0)
85
  size_ -= to-unsigned-like(d);
86
- else
87
- size_ += to-unsigned-like(-d);
88
- return *this;
89
- ```
90
- - Otherwise,
91
- ``` cpp
92
- ranges::advance(begin_, n, end_);
93
  return *this;
94
  ```
95
 
96
  ``` cpp
97
  template<size_t N, class I, class S, subrange_kind K>
98
- requires (N < 2)
99
  constexpr auto get(const subrange<I, S, K>& r);
100
  template<size_t N, class I, class S, subrange_kind K>
101
  requires (N < 2)
102
  constexpr auto get(subrange<I, S, K>&& r);
103
  ```
 
76
  constexpr subrange& advance(iter_difference_t<I> n);
77
  ```
78
 
79
  *Effects:* Equivalent to:
80
 
 
81
  ``` cpp
82
+ if constexpr (bidirectional_iterator<I>) {
83
+ if (n < 0) {
84
+ ranges::advance(begin_, n);
85
+ if constexpr (StoreSize)
86
+ size_ += to-unsigned-like(-n);
87
+ return *this;
88
+ }
89
+ }
90
+
91
  auto d = n - ranges::advance(begin_, n, end_);
92
+ if constexpr (StoreSize)
93
  size_ -= to-unsigned-like(d);
 
 
 
 
 
 
 
94
  return *this;
95
  ```
96
 
97
  ``` cpp
98
  template<size_t N, class I, class S, subrange_kind K>
99
+ requires ((N == 0 && copyable<I>) || N == 1)
100
  constexpr auto get(const subrange<I, S, K>& r);
101
  template<size_t N, class I, class S, subrange_kind K>
102
  requires (N < 2)
103
  constexpr auto get(subrange<I, S, K>&& r);
104
  ```