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

3912. enumerate_view::iterator::operator- should be noexcept

Section: 26.7.23.3 [range.enumerate.iterator] Status: Tentatively Ready Submitter: Hewill Kang Opened: 2023-03-27 Last modified: 2023-05-24

Priority: Not Prioritized

View other active issues in [range.enumerate.iterator].

View all other issues in [range.enumerate.iterator].

View all issues with Tentatively Ready status.

Discussion:

The distance between two enumerate_view::iterator is calculated by subtracting two integers, which never throws.

[2023-05-24; Reflector poll]

Set status to Tentatively Ready after five votes in favour during reflector poll.

Proposed resolution:

This wording is relative to N4944.

  1. Modify 26.7.23.3 [range.enumerate.iterator] as indicated:

    
    namespace std::ranges {
      template<view V>
        requires range-with-movable-references<V>
      template<bool Const>
      class enumerate_view<V>::iterator {
        […]
        public:
        […]
        friend constexpr difference_type operator-(const iterator& x, const iterator& y) noexcept;
        […]
      }
      […]
    }
    
    […]
    
    friend constexpr difference_type operator-(const iterator& x, const iterator& y) noexcept;
    

    -19- Effects: Equivalent to: return x.pos_ - y.pos_;