Skip to content

<array>: Should array<T, N> iterators depend on N? #211

Open

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:

STL/stl/inc/xutility

Lines 2759 to 2760 in 6b0238d

template <class _Ty, size_t _Size>
class _Array_const_iterator

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.

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

Metadata

Assignees

No one assigned

    Labels

    throughputMust compile fastervNextBreaks binary compatibility

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions