From 2a687481179506484b9d4c3dd5fd97fc3e4272f3 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Mon, 28 Oct 2019 13:57:21 +0100 Subject: [PATCH] Add missing delete operators on MacOS --- libsrc/core/ngcore_api.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libsrc/core/ngcore_api.hpp b/libsrc/core/ngcore_api.hpp index 4841eb07..6f6e7756 100644 --- a/libsrc/core/ngcore_api.hpp +++ b/libsrc/core/ngcore_api.hpp @@ -74,6 +74,22 @@ inline void operator delete[]( void* ptr, std::align_val_t al ) noexcept delete[] (char*)ptr; } +inline void operator delete ( void* ptr, std::size_t sz, std::align_val_t al ) noexcept +{ + if (int(al) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) + _mm_free(ptr); + else + delete (char*)ptr; +} + +inline void operator delete[]( void* ptr, std::size_t sz, std::align_val_t al ) noexcept +{ + if (int(al) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) + _mm_free(ptr); + else + delete[] (char*)ptr; +} + #endif // __MAC_OS_X_VERSION_MIN_REQUIRED #endif // __MAC_OS_X_VERSION_MIN_REQUIRED < 101300