template <typename T> XArray

Inherited from NULL

Inherited by NULL

Friend class NULL

Description

XArray是一个封装了数组功能的模板类,主要用于数据对象里需要保存变长数据的场合,对数据对象的任何修改即意味着变长数组的重建(当数组长度变化时)。与标准库里面的vector不一样,它不太适用于可以随时添加元素的场景,但是另一方面它也有效降低了该类的复杂度,开发者要根据实际情况觉得是否使用XArray类。

Members

Public interface


size_t m_Size

数组长度

T * m_pVec

数组首地址


XArray(int size = 0)

const T * end() const

XArray<T> & operator = (const XArray<T> &r)

XArray(const XArray<T> & r)

~XArray()

void release()

void alloc()

void remove(int i)

int size() const

T & front()

T & back()

const T & front() const

const T & back() const

void resize(int size, bool bCopyFromOld = false)

T * data()

const T * data() const

operator T *() const

T& operator [](int index)

const T& operator [](int index) const

T& at(int index)

const T& at(int index) const

void assign(const XArray<T> & r)

void append(const XArray<T> & r)

void assign(const T * pSrc, int size)

void insert(int index, const T & item)

XArray<T> & operator = (const vector<T> & vec)