![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/util/UniquePtr.h>
Public Member Functions | |
| UniquePtr (void) | |
| UniquePtr (T *ptr) | |
| UniquePtr (UniquePtr< T > &ptr) | |
| ~UniquePtr (void) | |
| bool | isNull (void) const |
| void | clean (void) |
| T * | detach (void) |
| void | set (T *ptr) |
| T * | get (void) const |
| UniquePtr< T > & | operator= (T *ptr) |
| UniquePtr< T > & | operator= (UniquePtr< T > &ptr) |
| operator T* (void) const | |
| T * | operator-> (void) const |
| operator bool (void) const | |
| T & | operator* (void) const |
Implements a pointer wrapper class ensuring there is only one owner of a pointed object. When a unique pointer is deleted, the pointed object is also deleted while when a unique pointer is assigned to another one, it looses the pointed object that is passed to assigned unique pointer.
| T | Type of pointed objects. |
|
inline |
References UniquePtr< T >::clean().
Free the pointed memory and set the pointer to null.
Referenced by UniquePtr< T >::~UniquePtr(), UniquePtr< T >::operator=(), and UniquePtr< T >::set().
|
inline |
Return the pointer and set it in the object to null (it will no more be automatically fried).
|
inline |
Test if the pointer is null.
Referenced by UniquePtr< T >::operator bool().
Same as !isNull().
References UniquePtr< T >::isNull().
|
inline |
References UniquePtr< T >::get().
|
inline |
Indirect access to the members of stored pointer.
References UniquePtr< T >::get().
|
inline |
Change the pointer contained in the unique pointer, the old pointer begin fried. Same as set().
| ptr | Pointer to set. |
References UniquePtr< T >::set().
References UniquePtr< T >::clean().
|
inline |
References UniquePtr< T >::clean().
Referenced by UniquePtr< T >::operator=().