Assuming I have 2 arrays of different sizes ie
int arr[] = {0,1,2,3,4,5,6,7,8,9}; int *arr2 = new int[5];
I want small copies of some of them, the deep equivalent of the copy will be
int j =0; if(!(i%2)) { arr2[j]=arr[i]; j++; }
At the moment, arr2 will output: 0, 2, 4, 6, 8
The reason I want to get a shallow copy is because I want arr2 to be updated with any changes to arr.
That is, if I loop and square all the elements in arr
I want arr2 to output: 0, 4, 16, 36, 64
These 2 arrays are part of the same class, one is my polygonal information, and the other part is data. arr is actually 4000+ elements in size, and arr2 is close to 3000. At the moment, my algorithm works fine with deep copy. but since I need to deeply copy 3000 elements to the update frame, I spend resources and wonder if I can somehow do it through a shallow copy, so I do not need to update arr2 every frame. As my code needs its work, arr really has duplicate arr2 values. arr2 is a list of points that are animated. then the data is duplicated on arr, which contain positional data for the vertices. this is because arr contains several bezier patches, some of them share one edge or more with another patch. but I want it to be ignored during the animation, otherwise gaps will appear on the surface.
It is important that the copy includes indexes such as
arr2[j]=arr[i];
since my code is configured. And that operation will be a low load.