This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

### 3384. `transform_view::sentinel` has an incorrect `operator-`

Section: 26.7.9.4 [range.transform.sentinel] Status: C++20 Submitter: Ville Voutilainen Opened: 2020-01-31 Last modified: 2021-02-25

Priority: 0

View all other issues in [range.transform.sentinel].

View all issues with C++20 status.

Discussion:

1. `transform_view::iterator` has an exposition-only member `current_` (26.7.9.3 [range.transform.iterator])

2. `transform_view::sentinel` has an exposition-only member `end_` (26.7.9.4 [range.transform.sentinel])

3. at 26.7.9.4 [range.transform.sentinel]/6 we have:

    friend constexpr range_difference_t<Base>
      operator-(const sentinel& y, const iterator<Const>& x)
        requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;

> Effects: Equivalent to: `return x.end_ - y.current_;`

`x` is an `iterator`, so it has `current_`, not `end_`. `y` is a `sentinel`, so it has `end_`, not `current_`.

[2020-02 Prioritized as IMMEDIATE Monday morning in Prague]

Proposed resolution:

This wording is relative to N4849.

1. Modify 26.7.9.4 [range.transform.sentinel] as indicated:

   >     friend constexpr range_difference_t<Base>
   >       operator-(const sentinel& y, const iterator<Const>& x)
   >         requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;

   > > -6- Effects: Equivalent to: `return xy.end_ - yx.current_;`