|
ADTF
|
Safely retrieve a valid object_ptr<> instance to *this when all we have is *this. More...
#include <object_ptr_utilities.h>
Public Member Functions | |
| object_ptr< T > | object_ptr_from_this () |
Retrieve an object_ptr with *this being the shared resource. | |
| object_ptr< const T > | object_ptr_from_this () const |
Retrieve an object_ptr with *this being the shared resource - const correct. | |
Protected Member Functions | |
| enable_object_ptr_from_this ()=default | |
| Default constructor. | |
| ~enable_object_ptr_from_this ()=default | |
| Default destructor. | |
| enable_object_ptr_from_this (const enable_object_ptr_from_this &)=default | |
| Default copy construction. | |
| enable_object_ptr_from_this & | operator= (const enable_object_ptr_from_this &)=default |
| Default copy assignment. | |
Friends | |
| template<typename Implementation, bool Fuse, typename Allocator, typename... Args> | |
| object_ptr< Implementation > | vision::allocate_object_ptr (Allocator &&allocator, Args &&... args) |
Safely retrieve a valid object_ptr<> instance to *this when all we have is *this.
This may be used in complete analogy to std::enable_shared_from_this, so please consult a documentation for that for further questions on the usage of this class.
object_ptr is from an shared resource managed by an already existing object_ptr, friend function make_object_ptr is the only possible way to assign a valid object_ptr. In other words, retrieving an object_ptr of *this from an object not managed by an object_ptr results in an empty object_ptr<T>. | T | Type of the shared resource that is managed by the object_ptr<> to retrieve. |
|
inline |
Retrieve an object_ptr with *this being the shared resource.
object_ptr with *this as the shared resource. If *this is not managed by a valid object_ptr, the returned object_ptr is empty.
|
inline |
Retrieve an object_ptr with *this being the shared resource - const correct.
object_ptr with *this as the shared resource. If *this is not managed by a valid object_ptr, the returned object_ptr is empty.