i’m trying to make tower defense game, i’m implementing game map for fast lookup entities in exact radius. I made it work with std::list ( for fast push_back entity pointer, and not bad deletion from any point of list), but i found that iterating through 1500 elements of list is super long. I cant hit even 10 FPS of my game. I’ll show what MSVS shows in profiler:

after getEntitiesInRadius call next is != operator which is comparison with end of list. Next is == operator call. It runs in debug mode. But i think even for debug iterating 1500 elements is too long. Maybe i wrong with this assertion?
I’d assume your map is of a fixed size throughout the game?
std::listis not at all a good choice if you want ‘fastest’, I’d start with avector, and only if that doesn’t suffice I’d look at other solutions.You say you use list for ‘fast push_back’, but unless a vector is being resized (which can be avoided by using
reserve, certainly on fixed size entities (as a game map would be)), push_back on a vector will be a lot faster.Deletion might be slower (but that’s not given).
On top of that, performance testing on a debug version doesn’t make sense at all, first make sure there is a problem before you try to solve it!