Commit 58006ffb authored by Cameron Pickett's avatar Cameron Pickett Committed by Facebook Github Bot

Fix issue where compiler cannot determine address of ::free at compile time

Reviewed By: Orvid

Differential Revision: D4921738

fbshipit-source-id: 69848cda3638fca4ead73dcc9949af0f600f33bb
parent 7de5a995
......@@ -137,7 +137,18 @@ std::weak_ptr<T> to_weak_ptr(const std::shared_ptr<T>& ptr) {
return std::weak_ptr<T>(ptr);
}
using SysBufferDeleter = static_function_deleter<void, ::free>;
namespace detail {
/**
* Not all STL implementations define ::free in a way that its address can be
* determined at compile time. So we must wrap ::free in a function whose
* address can be determined.
*/
inline void SysFree(void* p) {
::free(p);
}
}
using SysBufferDeleter = static_function_deleter<void, &detail::SysFree>;
using SysBufferUniquePtr = std::unique_ptr<void, SysBufferDeleter>;
inline SysBufferUniquePtr allocate_sys_buffer(size_t size) {
return SysBufferUniquePtr(::malloc(size));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment