From f81be4b4587587a8c183d908d137efcc0f95b3b9 Mon Sep 17 00:00:00 2001 From: Quentin Khan <quentin.khan@inria.fr> Date: Mon, 25 Jan 2016 15:54:17 +0100 Subject: [PATCH] Add simple c++14 make_unique replacement when compiling with c++11 --- Src/Utils/make_unique.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Src/Utils/make_unique.hpp diff --git a/Src/Utils/make_unique.hpp b/Src/Utils/make_unique.hpp new file mode 100644 index 000000000..f2dce792c --- /dev/null +++ b/Src/Utils/make_unique.hpp @@ -0,0 +1,17 @@ +#if __cplusplus < 201402L + +#ifndef _SCALFMM_MAKE_UNIQUE_HPP_ +#define _SCALFMM_MAKE_UNIQUE_HPP_ + +#include <utility> +#include <memory> + +namespace std { + template<class T, class... Args> + std::unique_ptr<T> make_unique(Args&&... args) { + return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); + } +} + +#endif +#endif -- GitLab