You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
World::entities is a vector of pointers, those pointers could be scattered in memory. Iterating over them might result in poor usage of CPU caches.
I tried changing std::vector<Entity*> entities; to std::vector<Entity> entities; but other problems arose. (Namely some systems might keep a pointer to a specific entity, the pointer becomes a dangling pointer when adding/removing items to the vector invalidates them)
I think my own inexperience with CPP is showing here, I'll revisit this when I feel more comfortable with it
World::entitiesis a vector of pointers, those pointers could be scattered in memory. Iterating over them might result in poor usage of CPU caches.I tried changing
std::vector<Entity*> entities;tostd::vector<Entity> entities;but other problems arose. (Namely some systems might keep a pointer to a specific entity, the pointer becomes a dangling pointer when adding/removing items to the vector invalidates them)I think my own inexperience with CPP is showing here, I'll revisit this when I feel more comfortable with it