I have a large size of vector and I want extract its subvector based on index. But I do not want to make a new copy of a subvector. Can I use pointer a iterator to return the pointer of the original vector?
something like:
vector<int> orig = { 0,1,2,3,4,5,6,7,8,9 };
vector<int> index = { 3,5,6,8 };
vector<int> dest (vector<int> orig, vector<int> index)
{
....
}
What I want get is get dest as { 3,5,6,8 } and it is point to orig but not the new copy. (index is the index vector of what I want to extract from the original vector)
Or, can I use smart pointer to do this?