79#ifdef USE_INITIALIZER_LIST
82 Vector(std::initializer_list<T> iniList) {
85 for (
auto &obj : iniList) {
102 for (
int j = 0; j <
size; j++) {
117 for (
int j = 0; j < copyFrom.
size(); j++) {
126 for (
int j = 0; j < copyFrom.
size(); j++) {
136 this->
len = to - from;
138 for (
size_t j = 0; j < this->
len; j++) {
166 for (
int j =
len; j >= 0; j--) {
182 size_t newLen = v2 - v1;
186 for (
auto ptr = v1; ptr != v2; ptr++) {
194 for (
int j = 0; j < number; j++) {
223 for (
int j = 0; j < newSize; j++) {
236 int oldSize = this->
len;
239 return this->
len != oldSize;
254 int lenToEnd =
len - pos - 1;
259 lenToEnd *
sizeof(T));
272 for (
int j = 0; j <
size(); j++) {
273 if (
p_data[j] == obj)
return j;
285 if (newSize <= 0 &&
p_data==
nullptr)
return;
293 if (newSize >
bufferLen || this->p_data ==
nullptr || shrink) {
298 this->bufferLen = newSize;
299 if (oldData !=
nullptr) {
300 if (copy && this->len > 0) {
307 cleanup(oldData, newSize, oldBufferLen);
319 data =
new T[newSize];
333 for (
int j = from; j < to; j++) {
#define bool
Definition stdbool.h:35
#define assert(expr)
Definition assert.h:32
#define index(str, chr)
Definition string.h:66
void * memmove(void *Dest, const void *Src, ACPI_SIZE Count)
Definition utclib.c:255
Memory allocateator which uses malloc.
Definition Allocator.h:34
void removeArray(T *obj, int len)
Definition Allocator.h:65
T * createArray(int len)
Definition Allocator.h:55
Iterator for the Vector class.
Definition Vector.h:26
size_t pos_
Definition Vector.h:29
bool operator<(iterator it)
Definition Vector.h:67
bool operator!=(iterator it)
Definition Vector.h:71
bool operator>=(iterator it)
Definition Vector.h:70
iterator()
Definition Vector.h:32
iterator operator--(int n)
Definition Vector.h:52
T * ptr
Definition Vector.h:28
bool operator<=(iterator it)
Definition Vector.h:68
size_t pos()
Definition Vector.h:75
T * getPtr()
Definition Vector.h:74
iterator operator++()
Definition Vector.h:47
iterator operator+(int offset)
Definition Vector.h:62
iterator(T *parPtr, size_t pos)
Definition Vector.h:33
bool operator>(iterator it)
Definition Vector.h:69
size_t operator-(iterator it)
Definition Vector.h:76
iterator(const iterator ©From)
Definition Vector.h:38
T & operator*()
Definition Vector.h:72
iterator operator--()
Definition Vector.h:57
iterator operator++(int n)
Definition Vector.h:42
T * operator->()
Definition Vector.h:73
bool operator==(iterator it)
Definition Vector.h:66
Vector implementation which provides the most important methods as defined by std::vector....
Definition Vector.h:18
void clear()
Definition Vector.h:151
int indexOf(T obj)
Definition Vector.h:271
Vector(size_t len=20, Allocator &allocator=DefaultAllocator)
default constructor
Definition Vector.h:93
void cleanup(T *data, int from, int to)
Definition Vector.h:332
int bufferLen
Definition Vector.h:279
void shrink_to_fit()
Definition Vector.h:231
iterator begin()
Definition Vector.h:242
void resize_internal(int newSize, bool copy, bool shrink=false)
Definition Vector.h:284
void assign(size_t number, T value)
Definition Vector.h:191
int capacity()
Definition Vector.h:233
bool resize(int newSize)
Definition Vector.h:235
void pop_front()
Definition Vector.h:179
void swap(Vector< T > &in)
Definition Vector.h:199
void push_front(T value)
Definition Vector.h:163
void erase(iterator it)
Definition Vector.h:249
Vector(Vector< T > &&moveFrom)=default
Move constructor.
virtual ~Vector()
Destructor.
Definition Vector.h:144
void push_back(T value)
Definition Vector.h:157
T & back()
Definition Vector.h:244
Vector< T > & operator=(Vector< T > ©From)
copy operator
Definition Vector.h:124
int size()
Definition Vector.h:153
Allocator * p_allocator
Definition Vector.h:282
Vector(Vector< T > ©From)
copy constructor
Definition Vector.h:114
Vector(int size, T value, Allocator &allocator=DefaultAllocator)
allocate size and initialize array
Definition Vector.h:99
void deleteArray(T *oldData, int oldBufferLen)
Definition Vector.h:324
bool empty()
Definition Vector.h:155
void erase(int pos)
Definition Vector.h:252
T & operator[](const int index) const
Definition Vector.h:219
T * p_data
Definition Vector.h:281
bool resize(int newSize, T value)
Definition Vector.h:221
T * newArray(int newSize)
Definition Vector.h:314
Vector & operator=(Vector &&obj)
Move operator.
int len
Definition Vector.h:280
Vector(T *from, T *to, Allocator &allocator=DefaultAllocator)
legacy constructor with pointer range
Definition Vector.h:134
T * data()
Definition Vector.h:267
void pop_back()
Definition Vector.h:173
void assign(iterator v1, iterator v2)
Definition Vector.h:181
T & operator[](int index)
Definition Vector.h:214
iterator end()
Definition Vector.h:246
size_t size_t offset
Definition drm_bridge.h:1299
Definition Allocator.h:19