From 95e74234a923dcd7bd7c43f76919c61cf46b4e69 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 21 Jan 2018 14:23:25 +0100 Subject: Allow custom deleters to be used with UPtr --- ingen/types.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ingen/types.hpp b/ingen/types.hpp index 90823b70..7cd1c386 100644 --- a/ingen/types.hpp +++ b/ingen/types.hpp @@ -17,6 +17,7 @@ #ifndef INGEN_TYPES_HPP #define INGEN_TYPES_HPP +#include #include #include "raul/Maid.hpp" @@ -24,7 +25,13 @@ namespace Ingen { template -using UPtr = std::unique_ptr; +void NullDeleter(T* ptr) {} + +template +struct FreeDeleter { void operator()(T* const ptr) { free(ptr); } }; + +template > +using UPtr = std::unique_ptr; template using SPtr = std::shared_ptr; @@ -35,9 +42,6 @@ using WPtr = std::weak_ptr; template using MPtr = Raul::managed_ptr; -template -void NullDeleter(T* ptr) {} - template SPtr static_ptr_cast(const SPtr& r) { return std::static_pointer_cast(r); -- cgit v1.2.1