Files
botw/src/KingSystem/Physics/physHeapUtil.h
T
2022-02-12 16:43:48 +01:00

22 lines
604 B
C++

#pragma once
#include <Havok/Common/Base/Object/hkReferencedObject.h>
namespace ksys::phys {
template <typename T>
inline std::enable_if_t<std::is_base_of_v<hkReferencedObject, 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