Browse Source

Changed global variable INIT_SIZE to start_size static variable within ArrayList.

release/0.19
JustinAJ 11 years ago
parent
commit
a3a45c07f2
  1. 7
      Jupiter/ArrayList.h

7
Jupiter/ArrayList.h

@ -97,6 +97,9 @@ namespace Jupiter
*/ */
~ArrayList(); ~ArrayList();
/** Initial size constant */
static const size_t start_size = 8;
/** Access Operator */ /** Access Operator */
inline T *operator[](size_t index) { return this->get(index); }; inline T *operator[](size_t index) { return this->get(index); };
@ -111,8 +114,6 @@ namespace Jupiter
// Implementation // Implementation
const size_t INIT_SIZE = 8;
template<typename T> size_t Jupiter::ArrayList<T>::expandArray() template<typename T> size_t Jupiter::ArrayList<T>::expandArray()
{ {
T **tmp = new T *[Jupiter::ArrayList<T>::dataSize * 2]; T **tmp = new T *[Jupiter::ArrayList<T>::dataSize * 2];
@ -123,7 +124,7 @@ template<typename T> size_t Jupiter::ArrayList<T>::expandArray()
return Jupiter::ArrayList<T>::dataSize; return Jupiter::ArrayList<T>::dataSize;
} }
template<typename T> Jupiter::ArrayList<T>::ArrayList() : ArrayList(INIT_SIZE) template<typename T> Jupiter::ArrayList<T>::ArrayList() : ArrayList(Jupiter::ArrayList<T>::start_size)
{ {
} }

Loading…
Cancel
Save