diff options
author | Chris Robinson <[email protected]> | 2019-01-01 14:33:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-01 14:33:01 -0800 |
commit | 2f1566e0b4e71f9b03ae8081e81a85f52ddeab23 (patch) | |
tree | e16fee5e76b8c1b581f3003d487d711cb29ce9de /common/almalloc.h | |
parent | c36798fd0759331caac80bb16cebe6c19a646090 (diff) |
Add and use a make_unique function
Diffstat (limited to 'common/almalloc.h')
-rw-r--r-- | common/almalloc.h | 7 |
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 */ |