4112. has-arrow should required operator->() to be const-qualified

Section: 25.5.2 [range.utility.helpers] Status: Ready Submitter: Hewill Kang Opened: 2024-06-22 Last modified: 2024-06-24

Priority: Not Prioritized

View all issues with Ready status.

Discussion:

The helper concept has-arrow in 25.5.2 [range.utility.helpers] does not require that I::operator->() be const-qualified, which is inconsistent with the constraints on reverse_iterator and common_iterator's operator->() as the latter two both require the underlying iterator has const operator->() member.

We should enhance the semantics of has-arrow so that implicit expression variations (18.2 [concepts.equality]) prohibit silly games.

[St. Louis 2024-06-24; move to Ready]

Proposed resolution:

This wording is relative to N4981.

  1. Modify 25.5.2 [range.utility.helpers] as indicated:

    […]
    
    template<class I>
      concept has-arrow =                                       // exposition only
        input_iterator<I> && (is_pointer_v<I> || requires(const I i) { i.operator->(); });
    
    […]