Manages the storage of a pointer, providing a limited garbage-collection facility, possibly sharing that management with other objects. More...
#include <ilog/shrptr.h>
Public Member Functions |
|
| IlSharedPtr (const IlSharedPtr< T > &other) | |
| Copy constructor. More... |
|
| IlSharedPtr (T *ptr=0) | |
| Constructor. More... |
|
| ~IlSharedPtr () | |
| Destructor. More... |
|
| T * | get () const |
| Access to the encapsulated pointer. More... |
|
| IlSharedPtr< T > & | operator= (const IlSharedPtr< T > &other) |
| Assignment operator. More... |
|
Detailed Description
template<class T>
class IlSharedPtr< T >
Manages the storage of a pointer, providing a limited garbage-collection facility, possibly sharing that management with other objects.
Library: ilog
This template class is largely inspired from the share_ptr template class provided in the ISO C++ Standard Template Library. It is replicated here (and substantially simplified) because of portability limitations. Only crucial methods are implemented.
Constructor & Destructor Documentation
◆ IlSharedPtr() [1/2]
| IlSharedPtr< T >::IlSharedPtr | ( | T * | ptr = 0 |
) |
Constructor.
Creates an initial reference on the pointer.
◆ IlSharedPtr() [2/2]
| IlSharedPtr< T >::IlSharedPtr | ( | const IlSharedPtr< T > & | other | ) |
Copy constructor.
Creates an additional reference on the encapsulated pointer.
◆ ~IlSharedPtr()
| IlSharedPtr< T >::~IlSharedPtr | ( | ) |
Destructor.
If no other smart pointer is sharing the encapsulated pointer, then it is deleted.
Member Function Documentation
◆ get()
| T* IlSharedPtr< T >::get | ( | ) | const |
Access to the encapsulated pointer.
- Returns
- The encapsulated pointer.
◆ operator=()
| IlSharedPtr<T>& IlSharedPtr< T >::operator= | ( | const IlSharedPtr< T > & | other | ) |
Assignment operator.
- Parameters
-
other The shared pointer to be copied.
