The CYIWeakArray is a smart pointer that does not take ownership of a dynamically allocated array of objects and will never delete the object. Instead, the CYIWeakArray will automatically point to nullptr should the array be deleted by the last CYISharedArray going out-of-scope.
Very similar to the CYIWeakPtr while providing the operator[] for your convenience.
Usage example:
#include <smartptr/YiSharedArray.h>
Public Types | |
| typedef CYIWeakPtr< YI_ARRAY_TYPE > | CYIWeakArray< YI_ARRAY_TYPE >YI_UNSPECIFIED_BOOL_TYPE |
Public Member Functions | |
| CYIWeakArray () | |
| CYIWeakArray (const CYIWeakArray< YI_ARRAY_TYPE > &rOther) | |
| template<typename YI_OTHER_ARRAY_TYPE > | |
| CYIWeakArray (const CYIWeakArray< YI_OTHER_ARRAY_TYPE > &rOther) | |
| CYIWeakArray (const CYISharedArray< YI_ARRAY_TYPE > &rOther) | |
| template<typename YI_OTHER_ARRAY_TYPE > | |
| CYIWeakArray (const CYISharedArray< YI_OTHER_ARRAY_TYPE > &rOther) | |
| void | Reset () |
| YI_ARRAY_TYPE * | Get () const |
| bool | IsNull () const |
| uint32_t | GetUseCount () const |
| void | Swap (CYIWeakArray< YI_ARRAY_TYPE > &rPtr) |
| bool | operator! () const |
| operator YI_UNSPECIFIED_BOOL_TYPE () const | |
| CYIWeakArray< YI_ARRAY_TYPE > & | operator= (const CYIWeakArray< YI_ARRAY_TYPE > &rOther) |
| template<typename YI_OTHER_PTR_TYPE > | |
| CYIWeakArray< YI_ARRAY_TYPE > & | operator= (const CYIWeakArray< YI_OTHER_PTR_TYPE > &rOther) |
| CYIWeakArray< YI_ARRAY_TYPE > & | operator= (const CYISharedArray< YI_ARRAY_TYPE > &rOther) |
| template<typename YI_OTHER_PTR_TYPE > | |
| CYIWeakArray< YI_ARRAY_TYPE > & | operator= (const CYISharedArray< YI_OTHER_PTR_TYPE > &rOther) |
| CYISharedArray< YI_ARRAY_TYPE > | ToStrongArray () const |
Friends | |
| template<typename YI_OTHER_PTR_TYPE > | |
| class | CYISharedArray |
| template<typename YI_OTHER_PTR_TYPE > | |
| class | CYIWeakArray |
| typedef CYIWeakPtr<YI_ARRAY_TYPE> CYIWeakArray< YI_ARRAY_TYPE >::CYIWeakArray< YI_ARRAY_TYPE >YI_UNSPECIFIED_BOOL_TYPE |
|
inline |
Constructs CYIWeakArray and sets its internal array to nullptr
|
inline |
Copy-Constructor that constructs CYIWeakArray and obtains array instance from another CYIWeakArray
| rOther | the pointer to array |
|
inline |
Copy-Constructor that constructs CYIWeakArray and obtains the array instance from another CYIWeakArray of a different type
| rOther | the pointer to array |
|
inline |
Constructs CYIWeakArray and obtains the array instance from another CYISharedArray of the same type
| rOther | the CYISharedArray to share an array ownership with |
|
inline |
Constructs CYIWeakArray and obtains the array instance from a CYISharedArray of a different type
| rOther | the CYISharedArray to share an array ownership with |
|
inline |
Accesses the internal object without taking ownership. Mostly for legacy code compatibility.
Example:
|
inline |
Returns the number of CYISharedPtr<T> objects that manage the object T.
|
inline |
Syntactic sugar for the operator!()
Example:
|
inline |
This function tests if the internal array is not set to nullptr.
Example:
|
inline |
This function tests if the internal object is set to nullptr.
Example:
|
inline |
This function resets the internal array to the one provided as a parameter.
| rOther | the pointer to share ownership of its array with. |
|
inline |
This function resets the internal array to the one provided as a parameter.
| rOther | the pointer to share ownership of its array with. |
|
inline |
This function resets the internal array to the one provided as a parameter.
| rOther | the pointer to share ownership of its array with. |
|
inline |
This function resets the internal array to the one provided as a parameter.
| rOther | the pointer to share ownership of its array with. |
|
inline |
This function resets its internal object to nullptr. It will never delete the object
|
inline |
Swap function that will move the weak reference of a object to a different CYIWeakPtr that could be living in a completely different scope.
Example:
| rPtr | the CYIScopedPtr to swap ownership with |
|
inline |
This function generates a strong reference of the array. A strong reference takes a shared ownership of the array and will delete the array when the last reference goes out-of-scope.
|
friend |
|
friend |