Skip to content

P2727 R4 std::iterator_interface #1404

@wg21bot

Description

@wg21bot
Collaborator

P2727R0 std::iterator_interface (Zach Laine)

Activity

added
LEWGLibrary Evolution
LEWGILibrary Evolution Incubator
on Dec 5, 2022
added this to the 2022-telecon milestone on Dec 5, 2022
removed
LEWGILibrary Evolution Incubator
on Dec 5, 2022
brycelelbach

brycelelbach commented on Jan 17, 2023

@brycelelbach

2023-01-17 Library Evolution Telecon

P2727R0: iterator_interface

2023-01-17 Library Evolution Telecon Minutes

Champion: Zach Laine

Chair: Bryce Adelstein Lelbach

Minute Taker: Ben Craig

Start: 2023-01-17 11:06 Eastern

Does this paper have:

  • Examples?
    • Yes.
  • Field experience?
    • Yes, but not from spec and not in the Standard Library.
    • The proposal is based on facilities from the Boost STL Interfaces library.
  • Performance considerations?
    • No.
  • Discussion of prior art?
    • Yes.
    • view_interface is prior art in the Standard Library.
    • Boost Iterator Facade/Adaptor was proposed as N1530.
  • Wording?
    • No.
  • Breaking changes?
    • No.
  • Feature test macro?
    • Needs one.
  • Freestanding?
    • It should be.

Open Questions:

  • Is CRTP inheritance the best way to do this? Are there any alternatives (wrapper type, etc)? Does this sort of thing need a language feature (mixins, etc)?
    • There's existing practice for this in the Standard Library - view_interface.
  • How does this compare to iterator, which we've deprecated?
  • Is iterator_interface_access, the mechanism for providing private access to user's types, novel in the Standard Library? Is there any existing practice?
  • How is this different from N1530? Why didn't N1530 get standardized?
  • Is this worth standardizing if it's not robust enough and performant enough to be used for essentially all iterator implementations, including those within the Standard Library.

Key Insights:

  • When the interface class is a dependent base class (e.g. the derived type is a template), names from the base class won't be injected. The paper should explore the implications of this.
  • The performance implications of using these interfaces should be explored, such as:
    • Inlining.
    • Compilation time.
    • Debug build performance.
    • Impact on auto-vectorization.
    • Performance surprises or trade-offs resulting from how the generic operations in the base classes are implemented.
  • access may be the wrong terminology for iterator_interface_access - it's already used in the standard library for a number of exception types (bad_variant_access, etc) and accessor.
  • interface may be the wrong terminology. We should bikeshed other names. However, interface is the terminology with precedence (view_interface).
  • The Ranges study group should see this.

Typos:

  • In section 2.6: "you can simply provided that operation in your type", should say "provide" instead of "provided".

It would be nice if we could do using my_base_class::* and get everything.

End: 12:02

Summary

This paper proposes facilities to ease writing iterators. The facilities are CRTP base classes and other helpers.

We reviewed the general design in depth. One issue that arose was the usability of these facilities when they are dependent base classes and names from the base classes are not injected into the derived class.

We also discussed potential performance implications, including both run-time and compile-time concerns.

This paper is in the early stages, so we'll definitely be seeing it again.

Next Steps

Revise the paper according to the following guidance and return to Library Evolution for further review:

added
ISShip vehicle: IS
C++26Targeted at C++26
B3 - additionBucket 3 as described by P0592: material that is not mentioned in P0592
needs-revisionPaper needs changes before it can proceed
on Jan 17, 2023

25 remaining items

added this to the 2024-telecon milestone on Feb 16, 2024
changed the title [-]P2727 R3 std::iterator_interface[/-] [+]P2727 R4 std::iterator_interface[/+] on Feb 16, 2024
added
scheduled-for-library-evolutionThis paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review
on Feb 17, 2024
ben-craig

ben-craig commented on Aug 6, 2024

@ben-craig

2024-08-06 Library Evolution Telecon

P2727R4: std::iterator_interface

2024-08-06 Library Evolution Telecon Minutes

Champion: Zach Laine
Chair: Ben Craig
Minute Taker: Mark Hoemmen

Summary

Mostly didn't have time to discuss, but there were mentions of objections to the design, so we should ensure that those objections are heard in the next meeting.

Next Steps

Wording and design discussion. Look up reflector discussions involving std::iterator_interface.

removed
scheduled-for-library-evolutionThis paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review
on Feb 6, 2025
inbal2l

inbal2l commented on Jun 3, 2025

@inbal2l
Member

Authors would like to experiment with encoperating new features in implementation. Marking as needs-revision till experiment result emerges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B3 - additionBucket 3 as described by P0592: material that is not mentioned in P0592C++29Targeted at C++29ISShip vehicle: ISLEWGLibrary Evolutionneeds-revisionPaper needs changes before it can proceedrangesstd::rangesready-for-library-evolution-meeting-reviewThis paper needs to be discussed at a Library Evolution meetingsize - largepaper size estimate

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @brycelelbach@ben-craig@FabioFracassi@cor3ntin@inbal2l

        Issue actions

          P2727 R4 std::iterator_interface · Issue #1404 · cplusplus/papers