diff --git a/ex02/src/Array.hpp b/ex02/src/Array.hpp index 92a7cf1..d653dac 100644 --- a/ex02/src/Array.hpp +++ b/ex02/src/Array.hpp @@ -1,5 +1,8 @@ #pragma once +#include +#include + template class Array { @@ -33,15 +36,15 @@ class Array return ; delete[] this->_arr; this->_size = src._size; - new this->_arr[src._size]; + new T[src._size]; for (size_t i = 0; i < src._size; i++) this->_arr[i] = src._arr[i]; }; Array& operator[](unsigned int index) - { - if (i >= _size) + { + if (index >= _size) throw std::exception(); - return _array[i]; + return _arr[index]; }; unsigned int size() const