Do I understand this correctly:
-Entity is Object<Entity>
-Instances of Object<Entity> have MemoryPool<Entity>
-Only objects of type Entity can be allocated into that specific pool
I dont see how the map works here, wont every instantiation of MemoryPool only allow a single type to be allocated anyways, which would mean that there will only every be a single key in the map? Im not very used to template code and static members so i might have misundestood something.
Anyways, I do have suggestions, assuming there is nothing fundamentally wrong in how the pool works:
-Would it be possible to use the hash_code of the type_info struct instead of the name for the map key? This way you wouldnt need to use std::string but could have an int instead which might be faster.
-Reserve some capacity into the vectors when you create them so they dont need to reallocate all the time
-You could try using an unorderer_set instead of a map, access is about O(1) I think. If the map access is a bottleneck.
-In your test code, make sure that the objects you compare are actually the same. In the code you posted, car is probably a single byte, while your Entity might even allocate memory because of the vector contained.
And of course, use a profiler to figure out what it is you are doing that is slowing down your pool.
You might want to consider a less intrusive option. Your classes probably should not know where and how they are allocated.