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

Address not_null design question #1499

Open
JordanMaples opened this issue Aug 15, 2019 · 2 comments
Open

Address not_null design question #1499

JordanMaples opened this issue Aug 15, 2019 · 2 comments
Assignees

Comments

@JordanMaples
Copy link

#379 #399 #509
see also #225

Microsoft/GSL not_null has an implicit conversion from T to not_null which doesn't follow the guidelines explicit conversions. However, making it explicit as the guidelines direct causes problems including being too verbose to use.

@hsutter
Copy link
Contributor

hsutter commented Dec 5, 2019

Editors' call: This set of issues deserves a new look at whether not_null should be a general type, a type that works only on raw pointers, or an alias. GDR will write a note.

@KVic
Copy link

KVic commented Jan 27, 2020

Let me express my humble opinion. I think that the not_null semantics is needed not only for raw pointers but also for smart pointers. And it should be consistent: if it is possible to create a shared_ptr from a unique_ptr, then it should be possible to create a not_null<shared_ptr> from a not_null<unique_ptr> and so on.

I researched this subject more deeply and wrote the C++ Object Token Library. Maybe it will help make decisions about the design of the gsl::not_null.

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

4 participants