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: 23.5.3 [move.iterators], 23.5.6 [iterators.counted], 24.7.6.3 [range.filter.iterator], 24.7.7.3 [range.transform.iterator], 24.7.13.4 [range.lazy.split.outer.value], 24.7.13.5 [range.lazy.split.inner], 24.7.18.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 23.5.3 [move.iterators], class template move_iterator synopsis, as indicated:

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

    constexpr const Iterator& base() const & noexcept;
    

    -1- Returns: current.

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

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

    constexpr const I& base() const & noexcept;
    

    -1- Effects: Equivalent to: return current;

  5. Modify 24.7.6.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 24.7.7.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 24.7.13.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 24.7.13.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 24.7.18.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_;