From 2f1566e0b4e71f9b03ae8081e81a85f52ddeab23 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 1 Jan 2019 14:33:01 -0800 Subject: Add and use a make_unique function --- common/almalloc.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'common/almalloc.h') diff --git a/common/almalloc.h b/common/almalloc.h index 26fa37ee..15d0263a 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -83,6 +83,13 @@ inline T* assume_aligned(T *ptr) noexcept #endif } +/* std::make_unique was added with C++14, so until we rely on that, make our + * own version. + */ +template +std::unique_ptr make_unique(ArgsT&&...args) +{ return std::unique_ptr{new T{std::forward(args)...}}; } + } // namespace al #endif /* AL_MALLOC_H */ -- cgit v1.2.3