From Jason Turner

[range.take.sentinel]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp21o978cp/{from.md → to.md} +14 -4
tmp/tmp21o978cp/{from.md → to.md} RENAMED
@@ -4,22 +4,28 @@
4
  namespace std::ranges {
5
  template<view V>
6
  template<bool Const>
7
  class take_view<V>::sentinel {
8
  private:
9
- using Base = conditional_t<Const, const V, V>; // exposition only
10
- using CI = counted_iterator<iterator_t<Base>>; // exposition only
 
11
  sentinel_t<Base> end_ = sentinel_t<Base>(); // exposition only
 
12
  public:
13
  sentinel() = default;
14
  constexpr explicit sentinel(sentinel_t<Base> end);
15
  constexpr sentinel(sentinel<!Const> s)
16
  requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
17
 
18
  constexpr sentinel_t<Base> base() const;
19
 
20
- friend constexpr bool operator==(const CI& y, const sentinel& x);
 
 
 
 
21
  };
22
  }
23
  ```
24
 
25
  ``` cpp
@@ -40,11 +46,15 @@ constexpr sentinel_t<Base> base() const;
40
  ```
41
 
42
  *Effects:* Equivalent to: `return `*`end_`*`;`
43
 
44
  ``` cpp
45
- friend constexpr bool operator==(const CI& y, const sentinel& x);
 
 
 
 
46
  ```
47
 
48
  *Effects:* Equivalent to:
49
  `return y.count() == 0 || y.base() == x.`*`end_`*`;`
50
 
 
4
  namespace std::ranges {
5
  template<view V>
6
  template<bool Const>
7
  class take_view<V>::sentinel {
8
  private:
9
+ using Base = maybe-const<Const, V>; // exposition only
10
+ template<bool OtherConst>
11
+ using CI = counted_iterator<iterator_t<maybe-const<OtherConst, V>>>; // exposition only
12
  sentinel_t<Base> end_ = sentinel_t<Base>(); // exposition only
13
+
14
  public:
15
  sentinel() = default;
16
  constexpr explicit sentinel(sentinel_t<Base> end);
17
  constexpr sentinel(sentinel<!Const> s)
18
  requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
19
 
20
  constexpr sentinel_t<Base> base() const;
21
 
22
+ friend constexpr bool operator==(const CI<Const>& y, const sentinel& x);
23
+
24
+ template<bool OtherConst = !Const>
25
+ requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
26
+ friend constexpr bool operator==(const CI<OtherConst>& y, const sentinel& x);
27
  };
28
  }
29
  ```
30
 
31
  ``` cpp
 
46
  ```
47
 
48
  *Effects:* Equivalent to: `return `*`end_`*`;`
49
 
50
  ``` cpp
51
+ friend constexpr bool operator==(const CI<Const>& y, const sentinel& x);
52
+
53
+ template<bool OtherConst = !Const>
54
+ requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
55
+ friend constexpr bool operator==(const CI<OtherConst>& y, const sentinel& x);
56
  ```
57
 
58
  *Effects:* Equivalent to:
59
  `return y.count() == 0 || y.base() == x.`*`end_`*`;`
60