I need to do the following:
std::vector<std::string> A;
std::vector<std::string> B;
==> pointer_to_vector<std::string> ptr;
//Some Code
ptr = A; //ptr points to object A
//Some More Code
ptr = B; // //ptr points to object B
During the program, ptr
needs to refer to both A
and B
at different times. How would it be implemented and considering that std::vector
makes reallocations, how to use smart pointers here?