revised cleanup method

This commit is contained in:
Lauchmelder 2021-12-26 14:49:55 +01:00
parent 48d2dbcb7e
commit e23d22153c

View file

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