Using the copy assignment operator ( Deep replication )
vector<int> array{3,5,2,6,4}; vector<int> outArray; outArray = array;
Leverage copy construction ( Deep replication )
vector<int> array{3,5,2,6,4}; vector<int> outArray(array);
utilize swap() function ( Swap two vector)
Will clear the original vector array
vector<int> array{3,5,2,6,4}; vector<int> outArray;// Set to null
outArray.swap(array);// empty array array
utilize assign() function ( Empty and copy deeply )
vector<int> array{3, 5, 2, 6, 4}; vector<int> outArray{ 1,2,3 };
outArray.assign(array.begin(),array.end());// Clear original data , Assign new data ={3,5,2,6,4}
outArray.assign(5, 0);//5 individual 0, Clear original data ={0,0,0,0,0,}
Memory Copy
vector<int> vec1 = {1, 2 , 3}; vector<int> vec2; //memcpy( &vec2, &vec1,
sizeof(int) * vec1.size() ); memmove(&vec2, &vec1, sizeof(int) * vec1.size());
//vec1 still {1,2,3}
Technology