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

Update the description for array.data #1904

Merged
merged 1 commit into from Jan 29, 2018
Merged

Update the description for array.data #1904

merged 1 commit into from Jan 29, 2018

Conversation

mclow
Copy link
Contributor

@mclow mclow commented Jan 29, 2018

Make it match the one for vector.
Compare [vector.data]/1 with the proposed [array.data]/1

Make it match the one for `vector`.
Compare [vector.data]/1 with the proposed [array.data]/1
@jwakely
Copy link
Member

jwakely commented Jan 29, 2018

LGTM. Note that [array.zero] covers the empty (N==0) case.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jan 29, 2018

This seems legit. The current phrasing is unfortunate in that the single-pass reading requires UB for the addressof(front()) case, and you don't find out until later that that case is actually different. The proposed change makes it rather clear where you can go if you care about size zero.

@tkoeppe tkoeppe merged commit c90e151 into cplusplus:master Jan 29, 2018
@mclow
Copy link
Contributor Author

mclow commented Jan 29, 2018

Note that [array.zero] covers the empty (N==0) case.

Almost. This section codifies that [data(), data() + size()) is a valid range, for all sizes.

@mclow
Copy link
Contributor Author

mclow commented Jan 29, 2018

I wish we could find a place to say this in [string.view], but I think that would NOT be editorial.

@mclow mclow deleted the patch-7 branch January 29, 2018 20:09
@jwakely
Copy link
Member

jwakely commented Jan 29, 2018

Right, I should have said that [array.zero] gives the exception to the data() == addressof(front()) rule. I think the proposed change is an improvement because we don't imply it's undefined (due to calling front()), then change our mind later in [array.zero].

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

Successfully merging this pull request may close these issues.

None yet

3 participants