summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ingen/types.hpp12
1 files 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 <cstdlib>
#include <memory>
#include "raul/Maid.hpp"
@@ -24,7 +25,13 @@
namespace Ingen {
template <class T>
-using UPtr = std::unique_ptr<T>;
+void NullDeleter(T* ptr) {}
+
+template <class T>
+struct FreeDeleter { void operator()(T* const ptr) { free(ptr); } };
+
+template <class T, class Deleter = std::default_delete<T>>
+using UPtr = std::unique_ptr<T, Deleter>;
template <class T>
using SPtr = std::shared_ptr<T>;
@@ -35,9 +42,6 @@ using WPtr = std::weak_ptr<T>;
template <class T>
using MPtr = Raul::managed_ptr<T>;
-template <class T>
-void NullDeleter(T* ptr) {}
-
template<class T, class U>
SPtr<T> static_ptr_cast(const SPtr<U>& r) {
return std::static_pointer_cast<T>(r);