Replace raw pointers with: object_ptr

Photo by Just Software Solutions

Provide a pointer-like object that won't own the pointee and can be used as a replacement of raw pointer. Does not allow pointer options like `delete` or pointer arithmetic to avoid potential dangerous actions. Find out what `std::experimental::observer_ptr` is and how you can use it in your project.

There is not much you can do with `jss::object_ptr` that you can't do with just `T*` in fact there is considerably less that you can do. Without explicitly requesting the stored `T*` you can only use it to access the pointed-to object, or compare it with other pointers.

"Yesterday I uploaded my object_ptr<T> implementation to under the Boost Software License. This is an implementation of a class similar to from the , but with various improvements suggested in ..."

Read more on the site

View Article

More info
#5th in TOP Native articles
Level Senior


Added by: Jack
Report article