Example code:
Code:
#include <iostream>
#include <vector>
using namespace std;

class A{
private:
    vector<int> v;
public:
    A() { for(size_t i = 0 ; i < 4 ; ++i) v.push_back(i); }
    vector<int>& getV() {return v;}
};

int main()
{
    A a;
    vector<int> foo = a.getV();
    
    return 0;
}
I read somewhere, that we can imagine the reference as a pointer to the vector.
So, my question is:
Let's assume that instance of class A, named a, was created with new. We call a.getV() to foo and then we call the destructor of a.
foo is safe? Is the copy constructor of std::vector called?