Skip to content

Experiments with C++17/20 pointers for ownership semantics, RAII

License

Notifications You must be signed in to change notification settings

geipel/pointers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pointers

Experiments with C++17/20 pointers for ownership semantics, RAII

Inspiration

C++ has had issues with consistant resource ownership and smart pointers. But there are some really good ideas about how to handle this.

In addition, C++17 and C++20 has since added features to make this somewhat easier.

The GSL: Guideline Support Library provides a GSL definition of the not_null<> class. This seems very interesting to me, but I think there's a useful generalization to define a default behavior for the default constructor, instead of dis-allowing it.

Goals

Explore the use of templates to define smart pointers that do not require ubiquitious validity tests like:

if (p->get() != nullptr) { ... use the pointer ... }

  • unambiguous ownership of underlying resources, scoped lifetime
  • thread safe
  • exception safe
  • portable
  • efficient
  • const-correct semantics
  • fully unit-tested
  • Investigate limited support for async-signal safe usage.

About

Experiments with C++17/20 pointers for ownership semantics, RAII

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published