Fix sparse_set invalid state when component constructor throws
Previously, a component's constructor that throws would cause the sparse
set to think that the entity still exists in the set. This is because the underlying
sparse set that stores the entities will have its entry added before the component
is added to the component set.
This could cause a number of invalid memory access problems such as the following:
1) Exception triggers destructor of enclosing object that then tries to remove
the component that was just added. SparseSet<entity_t, Component>::has() will
return true for the entity but when destroy() is called "instances" will be empty
so instances.back() will be invalid.
2) If the exception is handled then calling get(entity) for the same entity
identifier that initially threw the exception will give a position for that
entity even though it was not added. This can cause an invalid memory access
or accessing the data of a different stored component.