Right now in my game engine I store my objects in an array whose size is defined at load time. This is all well and good but what do I do when an object is added during runtime like using some kind of spawner, the array would have to expand and this is slow. Ideally I would have something similar to Bullet Physics where I can do:
dynamicsWorld->addRigidBody(body);
How would something like that work? I never defined a specific size. Does it use a container class from STL?
If you're using C++, and not using the STL, you're doing something wrong. Yes yes, there are exceptions to this rule, but if you're in a position to ask a question like this, you are not the
exception.
Anyway, as zacaj said, use an std::vector. Or, perhaps an std::map if you want more convenient and potentially faster lookup.
Why do you think that resizing array is slow?
Use std::vector and forget the resizing. I cannot imagine a scenario where this could become bottleneck unless you are doing something very weird. And in the latter case you should fix that weirdness, not worry about vector resizing speed.