aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-01-01 14:33:01 -0800
committerChris Robinson <[email protected]>2019-01-01 14:33:01 -0800
commit2f1566e0b4e71f9b03ae8081e81a85f52ddeab23 (patch)
treee16fee5e76b8c1b581f3003d487d711cb29ce9de /common
parentc36798fd0759331caac80bb16cebe6c19a646090 (diff)
Add and use a make_unique function
Diffstat (limited to 'common')
-rw-r--r--common/almalloc.h7
1 files changed, 7 insertions, 0 deletions
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<typename T, typename ...ArgsT>
+std::unique_ptr<T> make_unique(ArgsT&&...args)
+{ return std::unique_ptr<T>{new T{std::forward<ArgsT>(args)...}}; }
+
} // namespace al
#endif /* AL_MALLOC_H */