mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1252195 - part 1 - implement UniqueFreePtr; r=Waldo
Just like UniquePtr<T>, except that we're going to delete the allocated memory with |free()|.
This commit is contained in:
parent
f568275042
commit
d1c83df637
@ -37,6 +37,21 @@ template<typename T, typename... Args>
|
||||
typename detail::UniqueSelector<T>::KnownBound
|
||||
MakeUniqueFallible(Args&&... aArgs) = delete;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
struct FreePolicy
|
||||
{
|
||||
void operator()(const void* ptr) {
|
||||
free(const_cast<void*>(ptr));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<typename T>
|
||||
using UniqueFreePtr = UniquePtr<T, detail::FreePolicy<T>>;
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_UniquePtrExtensions_h
|
||||
|
Loading…
Reference in New Issue
Block a user