Hello.

I'm going to create a stack of pointers to objects, and I need to implement an identifier with the best performance.
Those objects are custom classes.

I'm wondering what would be best for performance. Either of these two ways, or maybe a third better way?.

1) Making an std::map for the stack, with a string identifier.
2) Making an std::vector with just the pointer, and then loop through all the objects (which may be 50+, each containing a few kilobytes), and read object::name which would be a string too.

And again to mention, if theres a better way, please hint me :)

Thank you ahead! :D

I'm going to create a stack of pointers to objects

You might also want to take a look at std::stack and std::deque

Ok I'll be looking at that.