added cleanup

This commit is contained in:
Lauchmelder 2021-12-26 14:43:11 +01:00
parent 7c16ca7913
commit 48d2dbcb7e

View file

@ -56,6 +56,15 @@ namespace lol
return it->second;
}
inline void Cleanup()
{
for(auto& [key, val] : objects)
{
if (val.use_count() < 3) // I hope I don't forget about this if I ever go multithreaded
objects.erase(key);
}
}
inline void Return(unsigned int id)
{
auto it = objects.find(id);