adding the shallow copy example

This commit is contained in:
Jidong Xiao
2024-02-06 00:43:39 -05:00
parent 3e18159388
commit 8d54d8c7df
2 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
#include <iostream>
#include "vec_shallow_copy.h"
int main(){
Vec<double> v(4, 0.0);
v[0] = 13.1; v[2] = 3.14;
Vec<double> u(v);
u[2] = 6.5;
u[3] = -4.8;
for (unsigned int i=0; i<4; ++i){
std::cout << u[i] << " " << v[i] << std::endl;
}
}