DynArray是一个栈和堆并行分配内存的动态数组,当数组大小在初始化长度以内时,我们不用堆分配内存,当数组超出初始化大小时,我们用vector分配内存,这对于数据项较小但增长不频繁的场景有着非常高的效率。
#ifndef ANYSEE_DYNARRAY_H
#define ANYSEE_DYNARRAY_H
#include
#include
#include
#include
#include
/** * @class DynamicArray * @brief A dynamic array that grows to fit any index for assignment. * */ namespace anysee { /* A dynamic array of compsite a vector implement. support constructors, etc. Has a small initial memory pool, so that low or no usage will not cause a call to new/delete */ template
class DynArray { public: DynArray(lfalloctor*