Browse Source

Added length-specifier constructor

release/0.19
JustinAJ 11 years ago
parent
commit
9e27c27ae8
  1. 13
      Jupiter/ArrayList.h

13
Jupiter/ArrayList.h

@ -81,6 +81,11 @@ namespace Jupiter
*/
ArrayList();
/**
* @brief Initializes the ArrayList's underlying array to a specified size.
*/
ArrayList(size_t length);
/**
* @brief Copy constructor for the ArrayList class.
*/
@ -118,9 +123,13 @@ template<typename T> unsigned int Jupiter::ArrayList<T>::expandArray()
return Jupiter::ArrayList<T>::dataSize;
}
template<typename T> Jupiter::ArrayList<T>::ArrayList()
template<typename T> Jupiter::ArrayList<T>::ArrayList() : ArrayList(length)
{
}
template<typename T> Jupiter::ArrayList<T>::ArrayList(size_t length)
{
Jupiter::ArrayList<T>::dataSize = INIT_SIZE;
Jupiter::ArrayList<T>::dataSize = length;
Jupiter::ArrayList<T>::data = new T*[Jupiter::ArrayList<T>::dataSize];
Jupiter::List<T>::length = 0;
}

Loading…
Cancel
Save