#pragma once #include namespace ksys::phys { template inline std::enable_if_t, void> deleteRefCountedHavokObject(T*& object) { if (!object) return; /// @bug This should just be a delete expression. Decrementing the reference count /// n times (with n = the reference count) is not how reference counting is supposed to work. for (int i = 0, n = object->getReferenceCount(); i < n; ++i) object->removeReference(); object = nullptr; } } // namespace ksys::phys