As title says, how can I get specific pair pointer from my map and put it to vector?
Here is my code:
std::map<std::string, Object*> scene_objects;
std::vector<std::pair<std::string, Object*>*> scene_objects_layers;
scene_objects_layers.insert(scene_objects_layers.begin(), scene_objects.find(*object->getName())); //not working
You can't. If you read the
map documentation you will see that nothing returns pointers to pairs. And there's not really anything that returns references to pairs with a useful lifetime, either.
So either store actual pairs in your vector (is there any real reason to use pointers to pairs?), or create copies of the pairs with