From Jason Turner

[range.subrange.ctor]

Diff to HTML by rtfpessoa

tmp/tmpbubdqas4/{from.md → to.md} RENAMED
@@ -14,35 +14,36 @@ constexpr subrange(convertible-to-non-slicing<I> auto i, S s,
14
  make-unsigned-like-t<iter_difference_t<I>> n)
15
  requires (K == subrange_kind::sized);
16
  ```
17
 
18
  *Preconditions:* \[`i`, `s`) is a valid range, and
19
- `n == `*`to-unsigned-like`*`(ranges::distance(i, s))`.
20
 
21
  *Effects:* Initializes *begin\_* with `std::move(i)` and *end\_* with
22
  `s`. If *StoreSize* is `true`, initializes *size\_* with `n`.
23
 
24
  [*Note 1*: Accepting the length of the range and storing it to later
25
  return from `size()` enables `subrange` to model `sized_range` even when
26
  it stores an iterator and sentinel that do not model
27
  `sized_sentinel_for`. — *end note*]
28
 
29
  ``` cpp
30
- template<not-same-as<subrange> R>
31
  requires borrowed_range<R> &&
32
  convertible-to-non-slicing<iterator_t<R>, I> &&
33
  convertible_to<sentinel_t<R>, S>
34
  constexpr subrange(R&& r) requires (!StoreSize || sized_range<R>);
35
  ```
36
 
37
  *Effects:* Equivalent to:
38
 
39
- - If *StoreSize* is `true`, `subrange{r, ranges::size(r)}`.
40
- - Otherwise, `subrange{ranges::begin(r), ranges::end(r)}`.
 
41
 
42
  ``` cpp
43
- template<not-same-as<subrange> PairLike>
44
  requires pair-like-convertible-from<PairLike, const I&, const S&>
45
  constexpr operator PairLike() const;
46
  ```
47
 
48
  *Effects:* Equivalent to: `return PairLike(`*`begin_`*`, `*`end_`*`);`
 
14
  make-unsigned-like-t<iter_difference_t<I>> n)
15
  requires (K == subrange_kind::sized);
16
  ```
17
 
18
  *Preconditions:* \[`i`, `s`) is a valid range, and
19
+ `n == `*`to-unsigned-like`*`(ranges::distance(i, s))` is `true`.
20
 
21
  *Effects:* Initializes *begin\_* with `std::move(i)` and *end\_* with
22
  `s`. If *StoreSize* is `true`, initializes *size\_* with `n`.
23
 
24
  [*Note 1*: Accepting the length of the range and storing it to later
25
  return from `size()` enables `subrange` to model `sized_range` even when
26
  it stores an iterator and sentinel that do not model
27
  `sized_sentinel_for`. — *end note*]
28
 
29
  ``` cpp
30
+ template<different-from<subrange> R>
31
  requires borrowed_range<R> &&
32
  convertible-to-non-slicing<iterator_t<R>, I> &&
33
  convertible_to<sentinel_t<R>, S>
34
  constexpr subrange(R&& r) requires (!StoreSize || sized_range<R>);
35
  ```
36
 
37
  *Effects:* Equivalent to:
38
 
39
+ - If *StoreSize* is `true`,
40
+ `subrange(r, static_cast<decltype(`*`size_`*`)>(ranges::size(r)))`.
41
+ - Otherwise, `subrange(ranges::begin(r), ranges::end(r))`.
42
 
43
  ``` cpp
44
+ template<different-from<subrange> PairLike>
45
  requires pair-like-convertible-from<PairLike, const I&, const S&>
46
  constexpr operator PairLike() const;
47
  ```
48
 
49
  *Effects:* Equivalent to: `return PairLike(`*`begin_`*`, `*`end_`*`);`