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
Prevent construction/conversion from nullptr #47
Comments
Ah, thank you for the pointer Moritz @mbs-c, I wasn't yet aware of this. I'll add the proposed constructor. |
martinmoene
added a commit
that referenced
this issue
Feb 5, 2022
martinmoene
added a commit
that referenced
this issue
Feb 5, 2022
martinmoene
added a commit
that referenced
this issue
Feb 5, 2022
martinmoene
added a commit
that referenced
this issue
Feb 12, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When introducing
string_view
into an old codebase, it is quite easy to accidentally leave nonsensical assignments from or comparisons tonullptr
in your code. Adding a deleted constructor as follows allows developers to easily identify the offending assignments and comparisons:C++23 will also disallow constructing
std::basic_string_view
fromnullptr
: cplusplus/papers#887The text was updated successfully, but these errors were encountered: