Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LWG-617: [sequences.general] <array> claimed to define a template meeting sequence container requirements #5916

Open
hubert-reinterpretcast opened this issue Oct 25, 2022 · 10 comments

Comments

@hubert-reinterpretcast
Copy link
Contributor

hubert-reinterpretcast commented Oct 25, 2022

This is now LWG-617.

[sequences.general] paragraph 1 claims that <array> is one of various headers that define class templates that meet the requirements for sequence containers.

<array> does not define such a template.

@JohelEGP
Copy link
Contributor

Why not? Reading [sequence.reqmts], it seems the intent is for it to be one, which means this is not editorial:

In addition, array is provided as a sequence container which provides limited sequence operations because it has a fixed number of elements.

@hubert-reinterpretcast
Copy link
Contributor Author

Just before the part you quoted, we have:

The library provides four basic kinds of sequence containers: vector, forward_list, list, and deque.

Thus, in context, the sentence you quoted is saying that, except for specific reasons why it isn't, array is a sequence container.

@JohelEGP
Copy link
Contributor

except for specific reasons why it isn't

This formulation seems wrong, because it is, according to the wording. Can you show a requirement it fails to meet?

@hubert-reinterpretcast
Copy link
Contributor Author

This formulation seems wrong, because it is, according to the wording. Can you show a requirement it fails to meet?

Just read [array.overview] paragraph 3?

@JohelEGP
Copy link
Contributor

An array meets some of the requirements of a sequence container.

So [array.overview]p3 disagrees with [sequences.general]p1 and [sequence.reqmts]p1.

@CaseyCarter
Copy link
Contributor

Meeting some of the requirements does not preclude meeting all of the requirements.

@JohelEGP
Copy link
Contributor

According to [sequence.reqmts]p5, array does not meet the sequence container requirements. It can't meet the initialization requirements just after it.

5
#
A type X meets the sequence container requirements if X meets the container requirements and the following statements and expressions are well-formed and have the specified semantics.

So only [sequences.general]p1 is wrong:

1
#
The headers , , <forward_­list>, , and define class templates that meet the requirements for sequence containers.

@CaseyCarter
Copy link
Contributor

CaseyCarter commented Oct 26, 2022

array<T, N> for N > 0 doesn't meet [container.reqmts]/10, so many specializations of array are neither containers nor contiguous containers, which means [array.overview]/1 and /3 are contradictory as well.

I don't think we can fix this all editorially, this probably deserves an LWG issue. (I think we probably want to make array be a sequence container by changing the requirements rather than yanking all the wording that suggests array is a sequence container.)

@CaseyCarter
Copy link
Contributor

This was LWG-617, which I believe was incorrectly resolved NAD.

@JohelEGP
Copy link
Contributor

This was LWG-617, which I believe was incorrectly resolved NAD.

And now it has been reopened.

@hubert-reinterpretcast hubert-reinterpretcast changed the title [sequences.general] <array> claimed to define a template meeting sequence container requirements LWG-617: [sequences.general] <array> claimed to define a template meeting sequence container requirements Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants