#include <scoped_array.h>
|
typedef T | element_type |
|
typedef T *(this_type::* | bool_) () const |
|
template<typename T, typename Deleter = smart_array_deleter<T>>
class eastl::scoped_array< T, Deleter >
class scoped_array
A scoped_array is the same as scoped_ptr but for arrays.
◆ bool_
template<typename T , typename Deleter = smart_array_deleter<T>>
Implicit operator bool Allows for using a scoped_ptr as a boolean. Example usage: scoped_array<int> ptr(new int[8]); if(ptr) ++ptr[2];
Note that below we do not use operator bool(). The reason for this is that booleans automatically convert up to short, int, float, etc. The result is that this: if(scopedArray == 1) would yield true (bad).
◆ this_type
template<typename T , typename Deleter = smart_array_deleter<T>>
this_type This is an alias for scoped_array<T>, this class.
◆ scoped_array() [1/2]
template<typename T , typename Deleter = smart_array_deleter<T>>
scoped_array This function is private in order to prevent copying, for safety.
◆ scoped_array() [2/2]
template<typename T , typename Deleter = smart_array_deleter<T>>
scoped_ptr Construct a scoped_ptr from a pointer allocated via new. Example usage: scoped_array<int> ptr(new int[6]);
◆ ~scoped_array()
template<typename T , typename Deleter = smart_array_deleter<T>>
~scoped_array Destroys the owned pointer. The destructors for each of the objects in the owned array will be called.
◆ detach()
template<typename T , typename Deleter = smart_array_deleter<T>>
detach This simply forgets the owned pointer. It doesn't free it but rather assumes that the user does. Example usage: scoped_array<int> ptr(new int[6]); int* pIntArray = ptr.get(); ptr.detach(); delete[] pIntArray;
◆ get()
template<typename T , typename Deleter = smart_array_deleter<T>>
get Returns the owned array pointer. Example usage: struct X{ void DoSomething(); }; scoped_array<int> ptr(new X[8]); X** ppX = ptr.get(); ppX[2]->DoSomething();
◆ operator!()
template<typename T , typename Deleter = smart_array_deleter<T>>
operator! This returns the opposite of operator bool; it returns true if the owned pointer is null. Some compilers require this and some don't. scoped_array<int> ptr(new int(3)); if(!ptr) assert(false);
◆ operator=() [1/2]
template<typename T , typename Deleter = smart_array_deleter<T>>
scoped_array This function is private in order to prevent copying, for safety.
◆ operator=() [2/2]
template<typename T , typename Deleter = smart_array_deleter<T>>
scoped_ptr This function is private in order to prevent copying, for safety.
◆ operator[]()
template<typename T , typename Deleter = smart_array_deleter<T>>
operator[] Returns a reference to the specified item in the owned pointer array. Example usage: scoped_array<int> ptr(new int[6]); int x = ptr[2];
◆ reset()
template<typename T , typename Deleter = smart_array_deleter<T>>
reset Deletes the owned pointer and takes ownership of the passed in pointer. If the passed in pointer is the same as the owned pointer, nothing is done. Example usage: scoped_array<int> ptr(new int[6]); ptr.reset(new int[7]); // deletes int[6] ptr.reset(NULL); // deletes int[7]
◆ swap()
template<typename T , typename Deleter = smart_array_deleter<T>>
swap Exchanges the owned pointer beween two scoped_array objects.
◆ mpArray
template<typename T , typename Deleter = smart_array_deleter<T>>
mpArray The owned pointer. Points to an array of T.
The documentation for this class was generated from the following file: