I have a world that I want to simulate and as soon as everything comes to rest, I want to terminate the simulation.
Is this as simple as iterating over all bodies to see if they're sleeping or does box2d have this facility built in?
What do you mean by 'terminate the simulation'? Do you mean terminate the application?
In any case, I doubt that Box2D has any such functionality built in. I suspect that your best bet is probably to iterate over the objects in the scene, as you describe. (If there is some shortcut though for determining whether all the objects in the simulation are inactive, I imagine someone will post it.)
Terminate the simulation loop. Was wondering if something like "do { world.step(); } while {world.thingAreStillMoving(); }" exist.