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

3593. Several iterators' base() const & and lazy_split_view::outer-iterator::value_type::end() missing noexcept

Section: 25.5.4 [move.iterators], 25.5.7 [iterators.counted], 26.7.8.3 [range.filter.iterator], 26.7.9.3 [range.transform.iterator], 26.7.16.4 [range.lazy.split.outer.value], 26.7.16.5 [range.lazy.split.inner], 26.7.22.3 [range.elements.iterator] Status: WP Submitter: Hewill Kang Opened: 2021-09-14 Last modified: 2021-10-17

Priority: Not Prioritized

View all other issues in [move.iterators].

View all issues with WP status.

Discussion:

LWG 3391 and 3533 changed some iterators' base() const & from returning value to returning const reference, which also prevents them from throwing exceptions, we should add noexcept for them. Also, lazy_split_view::outer-iterator::value_type::end() can be noexcept since it only returns default_sentinel.

[2021-09-24; Reflector poll]

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

[2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4892.

  1. Modify 25.5.4 [move.iterators], class template move_iterator synopsis, as indicated:

    […]
    constexpr const iterator_type& base() const & noexcept;
    constexpr iterator_type base() &&;
    […]
    
  2. Modify 25.5.4.5 [move.iter.op.conv] as indicated:

    constexpr const Iterator& base() const & noexcept;
    

    -1- Returns: current.

  3. Modify 25.5.7.1 [counted.iterator], class template counted_iterator synopsis, as indicated:

    […]
    constexpr const I& base() const & noexcept;
    constexpr I base() &&;
    […]
    
  4. Modify 25.5.7.3 [counted.iter.access] as indicated:

    constexpr const I& base() const & noexcept;
    

    -1- Effects: Equivalent to: return current;

  5. Modify 26.7.8.3 [range.filter.iterator] as indicated:

    […]
    constexpr const iterator_t<V>& base() const & noexcept;
    constexpr iterator_t<V> base() &&;
    […]
    
    […]
    constexpr const iterator_t<V>& base() const & noexcept;
    

    -5- Effects: Equivalent to: return current_;

  6. Modify 26.7.9.3 [range.transform.iterator] as indicated:

    […]
    constexpr const iterator_t<Base>& base() const & noexcept;
    constexpr iterator_t<Base> base() &&;
    […]
    
    […]
    constexpr const iterator_t<Base>& base() const & noexcept;
    

    -5- Effects: Equivalent to: return current_;

  7. Modify 26.7.16.4 [range.lazy.split.outer.value] as indicated:

    […]
    constexpr inner-iterator<Const> begin() const;
    constexpr default_sentinel_t end() const noexcept;
    […]
    
    […]
    constexpr default_sentinel_t end() const noexcept;
    

    -3- Effects: Equivalent to: return default_sentinel;

  8. Modify 26.7.16.5 [range.lazy.split.inner] as indicated:

    […]
    constexpr const iterator_t<Base>& base() const & noexcept;
    constexpr iterator_t<Base> base() &&;
    […]
    
    […]
    constexpr const iterator_t<Base>& base() const & noexcept;
    

    -3- Effects: Equivalent to: return i_.current;

  9. Modify 26.7.22.3 [range.elements.iterator] as indicated:

    […]
    constexpr const iterator_t<Base>& base() const& noexcept;
    constexpr iterator_t<Base> base() &&;
    […]
    
    […]
    constexpr const iterator_t<Base>& base() const& noexcept;
    

    -6- Effects: Equivalent to: return current_;