Skip to content

Commit

Permalink
Added overloads for placement new
Browse files Browse the repository at this point in the history
This allows calling new (...) JPH::XXX instead of having to call ::new (...) JPH::XXX
  • Loading branch information
jrouwe committed Dec 11, 2024
1 parent c10d9b2 commit 2f3f4e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Jolt/Core/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ JPH_EXPORT void RegisterDefaultAllocator();
JPH_INLINE void *operator new (size_t inCount, std::align_val_t inAlignment) { return JPH::AlignedAllocate(inCount, static_cast<size_t>(inAlignment)); } \
JPH_INLINE void operator delete (void *inPointer, [[maybe_unused]] std::align_val_t inAlignment) noexcept { JPH::AlignedFree(inPointer); } \
JPH_INLINE void *operator new[] (size_t inCount, std::align_val_t inAlignment) { return JPH::AlignedAllocate(inCount, static_cast<size_t>(inAlignment)); } \
JPH_INLINE void operator delete[] (void *inPointer, [[maybe_unused]] std::align_val_t inAlignment) noexcept { JPH::AlignedFree(inPointer); }
JPH_INLINE void operator delete[] (void *inPointer, [[maybe_unused]] std::align_val_t inAlignment) noexcept { JPH::AlignedFree(inPointer); } \
JPH_INLINE void *operator new ([[maybe_unused]] size_t inSize, void *inPointer) noexcept { return inPointer; } \
JPH_INLINE void *operator new[] ([[maybe_unused]] size_t inSize, void *inPointer) noexcept { return inPointer; }

#else

Expand Down

0 comments on commit 2f3f4e2

Please sign in to comment.