Add std::nullptr_t constructor overload for ref_ptr #1110
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a
std::nullptr_tconstructor overload forvsg::ref_ptr, allowingref_ptrto be constructed fromnullptr. This is more consistent with other smart pointer implementations, likestd::shared_ptr, and makes some things less verbose that previously needed an explicitly-default-constructed-explicitly-typedref_ptrfor templates to resolve more concise.I've demonstrated that change in a few places that I'd already worked on, but there are more that could benefit if it's more consistent with the project's desired code style. A repo-wide regex search for
ref_ptr<[^()]*>\(\)will reveal them. Even if it's not wanted for the VSG itself, the overload is still a good thing to have.