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.

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

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

Priority: Not Prioritized

View all issues with WP 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]

[Wrocław 2024-11-23; Status changed: Voting → WP.]

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->(); });
    
    […]