Skip to content

not_null pointer type, and unique/shared constructors #415

@rianquinn

Description

@rianquinn

Two questions:

  • Why does not_null take a pointer type instead of a non-pointer type like span, unique_ptr and shared_ptr. That is:
auto safe_ptr = gsl::not_null<int *>(ptr) // Currently
auto safe_ptr = gsl::not_null<int>(ptr) // Why not this?
  • Is there a reason there is no constructor for unique_ptr / shared_ptr instead of having to use get()?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions