modifications on the vector.h

This commit is contained in:
davoudn 2024-06-10 14:00:07 +03:30
parent 07f4829a94
commit 3d23ff6168
3 changed files with 9 additions and 4 deletions

View File

@ -1,13 +1,14 @@
#include "shapes.h" #include "shapes.h"
#include "vector.h" #include "vector.h"
#include <vector>
int main(){ int main(){
myspace::vector<double> a(10,5.0); // myspace::vector<double> a(10,5.0);
std::cout<< a[15] << "\n"; // std::cout<< a[0] << "\n";
myspace::vector<Cube> a(10,Cube()); // myspace::vector<Cube> b(10,Cube());
std::vector<Cube> c(10,Cube());
return 0; return 0;
} }

View File

@ -29,6 +29,10 @@ vector<T>::vector(int _N, T _Val ):N(_N){
template <typename T> template <typename T>
vector<T>::~vector(){ vector<T>::~vector(){
for (int i{0};i < N; i++){
delete data[i];
std :: cout << i << "\n";
}
delete [] data; delete [] data;
} }