ex02: fix: add include fix syntax

This commit is contained in:
Camille Chauvet 2023-10-04 14:12:05 +00:00
parent 066d646cf5
commit 90b510cf0c

View File

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