Issue 4112: has-arrow should required operator->() to be const-qualified (original) (raw)


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
    concept has-arrow = // exposition only
    input_iterator && (is_pointer_v || requires(const I i) { i.operator->(); });

    […]