Title
elements_view::sentinel's first operator- has wrong return type
Status
nad editorial
Section
[range.elements.sentinel]
Submitter
Hewill Kang

Created on 2021-05-28.00:00:00 last changed 35 months ago

Messages

Date: 2021-06-07.17:01:00

Proposed resolution:

This wording is relative to N4885.

  1. Modify [range.elements.sentinel] as indicated:

        […]
        template<bool OtherConst>
          requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
        friend constexpr range_difference_t<Basemaybe-const<OtherConst, V>>
          operator-(const iterator<OtherConst>& x, const sentinel& y);
        
        template<bool OtherConst>
          requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
        friend constexpr range_difference_t<maybe-const<OtherConst, V>>
          operator-(const sentinel& x, const iterator<OtherConst>& y);
      };
    }
    
    […]
    template<bool OtherConst>
      requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
    friend constexpr range_difference_t<Basemaybe-const<OtherConst, V>>
      operator-(const iterator<OtherConst>& x, const sentinel& y);
    

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

Date: 2021-06-07.00:00:00

[ 2021-06-07 Fixed by editorial issue #4603. Status changed: New → NAD Editorial. ]

Date: 2021-05-28.00:00:00

Because the iterator type of the first operator- is const iterator<OtherConst>&, its return type should be range_difference_t<maybe-const<OtherConst, V>>.

History
Date User Action Args
2021-06-07 17:01:00adminsetmessages: + msg11917
2021-06-07 17:01:00adminsetstatus: new -> nad editorial
2021-05-28 17:57:49adminsetmessages: + msg11863
2021-05-28 00:00:00admincreate