69 void resize(
int newsize, T val = T());
96 void erase(
size_t index);
113 const T&
at(
int n)
const;
125 const T&
front()
const;
131 const T&
back()
const;
137 const T*
data()
const;
176 return *_curr == *b._curr;
181 return *_curr != *b._curr;
193 :_size(0), _elements(0), _space(0)
198 :_size(s), _elements(new T[s])
200 for (
int index = 0; index < _size; ++index)
201 _elements[index] = T();
206 :_size(arg._size), _elements(new T[arg._size])
208 for (
int index = 0; index < arg._size; ++index)
209 _elements[index] = arg._elements[index];
215 if (
this == &a)
return *
this;
218 if (a._size <= _space)
220 for (
int index = 0; index < a._size; ++index)
222 _elements[index] = a._elements[index];
228 T* p =
new T[a._size];
230 for (
int index = 0; index < a._size; ++index)
231 p[index] = a._elements[index];
303 if (newalloc <= _space)
return;
305 T* p =
new T[newalloc];
307 for (
int i = 0; i < _size; ++i)
322 for (
int index = _size; index < newsize; ++index)
323 _elements[index] = T();
342 else if (_size == _space)
345 _elements[_size] = d;
353 if (index >= 0 && index <
size())
355 for(
size_t i=index;i<(
size()-1);i++)
356 _elements[i] = _elements[i+1];
406 return _elements[_size - 1];
412 return _elements[_size - 1];
Definition Collections.h:151
iterator & operator++()
Definition Collections.h:157
iterator(T *p)
Definition Collections.h:153
bool operator!=(const iterator &b) const
Definition Collections.h:179
bool operator==(const iterator &b) const
Definition Collections.h:174
T & operator*()
Definition Collections.h:169
iterator & operator--()
Definition Collections.h:163
T & front()
Definition Collections.h:392
const iterator cend() const
Definition Collections.h:280
const iterator cbegin() const
Definition Collections.h:274
void erase(size_t index)
Definition Collections.h:351
Vector()
Definition Collections.h:192
Vector< T > & operator=(const Vector< T > &arg)
Definition Collections.h:213
T * data()
Definition Collections.h:416
void resize(int newsize, T val=T())
Definition Collections.h:318
T & back()
Definition Collections.h:404
size_t capacity() const
Definition Collections.h:295
size_t size() const
Definition Collections.h:329
T & at(int n)
Definition Collections.h:366
iterator end()
Definition Collections.h:262
iterator begin()
Definition Collections.h:250
bool empty() const
Definition Collections.h:289
void reserve(int newmalloc)
Definition Collections.h:301
T & operator[](int i)
Definition Collections.h:380
void push_back(const T &d)
Definition Collections.h:338
~Vector()
Definition Collections.h:241
Definition Collections.h:4