Pointer juggling

I'm running into an access violation error that I can't seem to resolve. I have a class called Scene, a class called Entity, and a struct called Group. A Scene contains member variables std::vector<Entity> entList and std::vector<Group> groupList. The Group struct is defined like this:
1
2
3
4
struct Group {
	std::string name;
	std::vector<Entity*> entities;
};

Its purpose is to help me organize bunches of entities together and more easily access similar entities from the scene's entList, which may be huge. In the Scene class's constructor I have something like this:
1
2
3
4
5
6
entList.push_back(Entity());// First entity added
	entList[0].entName = std::string("Cam0");

        groupList.push_back(Group());
	groupList[0].name = std::string("Cameras");
	groupList[0].entities.push_back(&entList[0]);

Later I try to access the name of the first entity in the list, in two different ways: directly from the entList, and indirectly through the Group I've assigned it to. The first way works, the second doesn't:
1
2
3
Scene scn = Scene();
std::cout << "\n" << scn.entList[0].entName;// This works
std::cout << "\n" << scn.groupList[0].entities[0]->entName;// This gives me an access violation 

What's wrong with my approach? I thought the pointer is valid all the way through; I certainly don't destroy the Entity before I try to access it via pointer.
Topic archived. No new replies allowed.