From 176da6e75e5099e642a506c93289972bdb96485d Mon Sep 17 00:00:00 2001 From: Jeremie Deray <jeremie.deray@pal-robotics.com> Date: Tue, 17 Oct 2017 12:07:00 +0200 Subject: [PATCH] add make_unique.h --- src/make_unique.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/make_unique.h diff --git a/src/make_unique.h b/src/make_unique.h new file mode 100644 index 000000000..f336eb4f7 --- /dev/null +++ b/src/make_unique.h @@ -0,0 +1,24 @@ +/** + * \file make_unique.h + * + * Created on: Oct 11, 2017 + * \author: Jeremie Deray + */ + +#ifndef _WOLF_MAKE_UNIQUE_H_ +#define _WOLF_MAKE_UNIQUE_H_ + +#include <memory> + +namespace wolf { + +/// @note this appears only in cpp14 +template <typename T, typename... Args> +std::unique_ptr<T> make_unique(Args&&... args) +{ + return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); +} + +} + +#endif /* _WOLF_MAKE_UNIQUE_H_ */ -- GitLab