Ah, just a example.
Now I'm working in getting components for a current entity just by a entity ID. Seems like have multiple ways of doing this.
From my point of view I have a component that have a ID (a primary key) a EntityManager that store a map<ID, SomeDerivedComponent>.
Then I have a RenderableSystem that operates on a PositionComponent (a Transform Matrix) and a RenderableComponent. So, in my RenderableSystem I have to find all entities that have Position and Renderable component using the entity ID. If they have both, operate, else don't operate. Every time that I add a component I have to insert the component in the system using something like insert<ID, RenderableComponent>.
eg:
id = 5;
Spatial s;
Renderable r;
s.id = id;
r.id = id;
spatials.insert(id, s);
renderables.insert(id, r);
for all entities e
if(spatials.find(e) && renderables.find(e))
//update with renderable system
What I want to know if is there some better ways of doing this or I must perform this loop every update.