Say I have a class similar to this.
class Actor {
public:
add()
{
auto tmp = std::make_shared<actor>();
actorListPtr.push_back(tmp);
}
static std::vector<shared_ptr<Actor>> & actorListPtr;
}
What I wish by this is to have a link to a separate vector, a vector with the same behavior for each individual instance of the class, referenced from another source. Any changes made in the source are to be reflected upon its pointer and vice versa. For instance.
std::vector<shared_ptr<Actor>> actorList;
Actor::actorListPtr = actorList;
Actor guy;
guy.add();
Should make the contents of actorListPtr
equal to actorList
. However, for me, this is not the case. What am I missing?