<array>: Should array<T, N> iterators depend on N?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
Long ago, we made most of our iterators SCARY (see WG21-N2911 and WG21-N2980). This means that they don't depend on allocators, comparators, etc.
array<T, N> iterators are an interesting case, as they're still templated on N:
I believe that for IDL=0 it would be better to avoid depending on N. That would reduce instantiations and improve throughput. For IDL=2 I'm less certain - if we don't template on N, we have to store it at runtime (which probably isn't a big deal, IDL=2 is already costly). If we do template on N (like today), then we'd be setting up an unusual situation where iterator types observably change depending on IDL (not just their representations).
vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with stl/inc/xutility#L2759-L2760 and the linked WG21-N2911 and WG21-N2980 papers to understand the current array<T, N> iterator design. Read #169 for the vNext constraint; done means deciding how IDL=0 and IDL=2 should depend on N and implementing the resulting ABI-breaking change once vNext is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100