diff options
Diffstat (limited to 'src/common/utils2.hpp')
-rw-r--r-- | src/common/utils2.hpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/utils2.hpp b/src/common/utils2.hpp index 5f02beb..2218625 100644 --- a/src/common/utils2.hpp +++ b/src/common/utils2.hpp @@ -214,17 +214,17 @@ struct is_array_of_unknown_bound : std::is_same<T, typename std::remove_extent<T>::type[]> {}; -template<class T, class... A> -typename std::enable_if<!is_array_of_unknown_bound<T>::value, std::unique_ptr<T>>::type make_unique(A&&... a) +template<class T, class D=std::default_delete<T>, class... A> +typename std::enable_if<!is_array_of_unknown_bound<T>::value, std::unique_ptr<T, D>>::type make_unique(A&&... a) { - return std::unique_ptr<T>(new T(a...)); + return std::unique_ptr<T, D>(new T(a...)); } -template<class T> -typename std::enable_if<is_array_of_unknown_bound<T>::value, std::unique_ptr<T>>::type make_unique(size_t sz) +template<class T, class D=std::default_delete<T>> +typename std::enable_if<is_array_of_unknown_bound<T>::value, std::unique_ptr<T, D>>::type make_unique(size_t sz) { typedef typename std::remove_extent<T>::type E; - return std::unique_ptr<E[]>(new E[sz]); + return std::unique_ptr<E[], D>(new E[sz]()); } #endif // UTILS2_HPP |