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

replace std::optional<T*> to std::optional<std::reference_wrapper<T>> #3

Closed
zyfjeff opened this issue Dec 29, 2020 · 3 comments
Closed
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@zyfjeff
Copy link
Collaborator

zyfjeff commented Dec 29, 2020

At present, the Object has an interface that returns the type std::optional<T*>. This return type is troublesome for the user. Is the returned pointer pointing to a valid address? In fact, the pointer here is always valid. This would not be a problem if the return type was std::optional<std::reference_wrapper<T>>.

@zyfjeff zyfjeff added enhancement New feature or request help wanted Extra attention is needed labels Dec 29, 2020
@zyfjeff zyfjeff changed the title replace std::optional<T*> to std::optional<std::reference_wrapper<T>> replace std::optional<T*> to std::optional<std::reference_wrapper<T>> Dec 29, 2020
@wbpcode
Copy link
Collaborator

wbpcode commented Dec 24, 2021

/assign

@wbpcode wbpcode self-assigned this Dec 24, 2021
@wbpcode
Copy link
Collaborator

wbpcode commented Dec 24, 2021

I will try land it and make the implementation more clean. 😄

@zyfjeff
Copy link
Collaborator Author

zyfjeff commented Oct 9, 2022

close by #20

@zyfjeff zyfjeff closed this as completed Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants