Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr objects may own the same object. The object is destroyed and its memory deallocated when either of the following happens:
1) the last remaining SharedPtr owning the object is destroyed.
2) the last remaining SharedPtr owning the object is assigned another pointer via operator=.
The object is destroyed using the delete operator.
More...
template<class T>
class daal::services::interface1::SharedPtr< T >
- Template Parameters
-
T | Class of the managed object |
◆ SharedPtr() [1/3]
Constructs an empty shared pointer
◆ SharedPtr() [2/3]
Constructs a shared pointer that manages an input pointer
- Parameters
-
◆ SharedPtr() [3/3]
Constructs a shared pointer that manages an input pointer
- Template Parameters
-
U | Class of the managed object |
D | Class of the deleter object |
- Parameters
-
[in] | ptr | Pointer to the managed object |
[in] | deleter | Object used to delete the pointer when the reference count becomes equal to zero |
◆ ~SharedPtr()
Decreases the reference count If the reference count becomes equal to zero, deletes the managed pointer
◆ get()
Returns a pointer to a managed object
- Returns
- Pointer to the managed object
◆ getStartPtr()
Returns a pointer to the beginning of owned memory
- Returns
- Pointer to the beginning of owned memory
◆ operator bool()
Checks if the managed pointer is not null
- Returns
- true if the managed pointer is not null
◆ operator*()
Dereferences a pointer to a managed object
- Returns
- Reference to the managed object
◆ operator->()
Dereferences a pointer to a managed object
- Returns
- Pointer to the managed object
◆ operator=()
Makes a copy of an input shared pointer and increments the reference count
- Parameters
-
[in] | ptr | Shared pointer to copy |
◆ reset()
◆ useCount()
Returns the number of shared_ptr objects referring to the same managed object
- Returns
- The number of shared_ptr objects referring to the same managed object
The documentation for this class was generated from the following file: