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

LWG4015 [optional.optional] Can we eliminate the exposition only member val? #4754

Open
frederick-vs-ja opened this issue Jul 16, 2021 · 4 comments

Comments

@frederick-vs-ja
Copy link
Contributor

frederick-vs-ja commented Jul 16, 2021

As std::optional has been required to propagate copy/move triviality, a pointer data member that always points to the contained value cannot be a viable implementation strategy if any of copy/move triviality is propagated.
Can we eliminate val and just use "the contained value" (or its address) instead?

@jensmaurer
Copy link
Member

This sounds plausible. After all, we can't really update an internal pointer during a trivial copy operation.

However, there are quite a few mentions of val in the text. @jwakely , what would be your preferred approach?

@jensmaurer
Copy link
Member

@jwakely , ping.

@jwakely
Copy link
Member

jwakely commented Sep 2, 2021

We could replace val->~T() with value().~T(), and talk about the state of value() instead of *val. And in the accessors that return val or *val we could talk about "the contained value". I think that could work, but it probably needs LWG review (or even an LWG issue).

@frederick-vs-ja
Copy link
Contributor Author

LWG4015 seemingly addresses this.

@frederick-vs-ja frederick-vs-ja changed the title [optional.optional] Can we eliminate the exposition only member val? LWG4015 [optional.optional] Can we eliminate the exposition only member val? Nov 25, 2023
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