38 #include <dime/Basic.h> 58 #ifdef _MSC_VER // Microsoft Visual C++ 59 #pragma warning(disable:4251) 60 #pragma warning(disable:4275) 71 void append(
const T &value);
74 void insertElem(
const int idx,
const T &value);
75 void setElem(
const int index,
const T &value);
76 T getElem(
const int index)
const;
77 void getElem(
const int index, T &elem)
const;
78 T getLastElem()
const;
79 void getLastElem(T &elem)
const;
80 T &operator [](
const int index);
81 T operator [](
const int index)
const;
102 template <
class T>
inline 105 this->array =
new T[size];
110 template <
class T>
inline 113 delete [] this->array;
116 template <
class T>
inline void 119 int oldsize = this->size;
120 T *oldarray = this->array;
122 this->array =
new T[this->size];
123 for (
int i = 0; i < oldsize; i++) this->array[i] = oldarray[i];
127 template <
class T>
inline void 130 if (this->num >= this->size) growArray();
131 this->array[this->num++] = elem;
135 template <
class T>
inline void 138 while (this->size <= this->num+array.
count()) growArray();
139 for (
int i=0;i<array.
count();i++)
140 this->array[this->num++] = array[i];
143 template <
class T>
inline void 146 int newsize=this->num+array.
count();
148 if (this->size<=newsize) {
149 T *oldarray=this->array;
150 this->array=
new T[newsize];
152 for (i=0;i<array.
count(); i++) this->array[i] = array[i];
153 for (i=0;i<this->num;i++) this->array[i+array.
count()] = oldarray[i];
157 for (i=0;i<this->num;i++) this->array[array.
count()+i]=this->array[i];
158 for (i=0;i<array.
count();i++) this->array[i] = array[i];
160 this->num+=array.
count();
163 template <
class T>
inline void 169 for (
int i = n; i > idx; i--) {
170 this->array[i] = this->array[i-1];
172 this->array[idx] = elem;
176 template <
class T>
inline void 179 while (index >= this->size) growArray();
180 if (this->num <= index) this->num = index+1;
181 this->array[index] = elem;
184 template <
class T>
inline T
187 return this->array[index];
190 template <
class T>
inline void 193 elem = this->array[index];
196 template <
class T>
inline T
199 return this->array[this->num-1];
202 template <
class T>
inline void 205 elem = this->array[this->num-1];
208 template <
class T>
inline T &
211 while (index >= this->size) growArray();
212 if (this->num <= index) this->num = index + 1;
213 return this->array[index];
216 template <
class T>
inline T
219 return this->array[index];
222 template <
class T>
inline void 225 if (this->num <= 0 || index >= this->num)
return;
226 for (
int i = index; i < this->num-1; i++)
227 this->array[i] = this->array[i+1];
231 template <
class T>
inline void 234 this->array[index] = this->array[--this->num];
237 template <
class T>
inline void 241 for (
int i=0;i<this->num/2;i++) {
243 this->array[i]=this->array[this->num-1-i];
244 this->array[this->num-1-i]=tmp;
248 template <
class T>
inline void 251 if (count < this->num)
255 template <
class T>
inline int 261 template <
class T>
inline int 267 template <
class T>
inline T *
273 template <
class T>
inline const T *
279 template <
class T>
inline void 282 delete [] this->array;
283 this->array =
new T[initsize];
284 this->size = initsize;
288 template <
class T>
inline void 291 delete [] this->array;
297 template <
class T>
inline void 300 T *oldarray = this->array;
301 this->array =
new T[this->num];
302 for (
int i = 0; i < this->num; i++) this->array[i] = oldarray[i];
303 this->size = this->num;
307 #endif // ! DIME_ARRAY_H The dimeArray class is internal / private.
Definition: Array.h:65
int allocSize() const
Definition: Array.h:262
int count() const
Definition: Array.h:256
const T * constArrayPointer() const
Definition: Array.h:274
T * arrayPointer()
Definition: Array.h:268
void removeElemFast(const int index)
Definition: Array.h:232
void makeEmpty(const int initsize=4)
Definition: Array.h:280
void freeMemory()
Definition: Array.h:289
void setCount(const int count)
Definition: Array.h:249
void removeElem(const int index)
Definition: Array.h:223
void shrinkToFit()
Definition: Array.h:298