isocpp / isocpp/CppCoreGuidelines
Consider whether not_null<> would be better replaced with contracts
@neilmacintosh is already working on this.
Since Sep 18, 2017.
- Dominant language
- CSS
- Stars
- 45.3k
- Forks
- 5.6k
- PR merge metrics
- No merged PRs in 30d
Description
F.23 gives examples of using not_null<> to specify a nullness constraint on a parameter. However, a type that carries a not-nullness constraint is problematic...it is rare that a variable is never null for its entire lifetime. It is more commonly a constraint on the variable at a specific point in its life: usually before it is passed to or returned from a function.
So it seems as though nullness/nonnullness constraints are better expressed via a contract-specification mechanism (yes, we lack on today...but Expects/Ensures is a way to workaround that for now).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.