From d400550af7ef85d6cf68e198c3fd046e871c7dfa Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Tue, 24 Nov 2015 14:32:53 +0100 Subject: [PATCH] Code is compatible with GCC 4.8 --- pointer/gcc_4_8_compatibility.h | 18 ++++++++++++++++++ pointer/unique_ref.h | 1 + 2 files changed, 19 insertions(+) create mode 100644 pointer/gcc_4_8_compatibility.h diff --git a/pointer/gcc_4_8_compatibility.h b/pointer/gcc_4_8_compatibility.h new file mode 100644 index 00000000..bf228c13 --- /dev/null +++ b/pointer/gcc_4_8_compatibility.h @@ -0,0 +1,18 @@ +#pragma once +#ifndef MESSMER_CPPUTILS_GCC48COMPATIBILITY_H +#define MESSMER_CPPUTILS_GCC48COMPATIBILITY_H + +#include + +#if __GNUC__ == 4 && __GNUC_MINOR__ == 8 +// Add std::make_unique +namespace std { + template + inline unique_ptr make_unique(Args&&... args) { + return unique_ptr(new T(std::forward(args)...)); + } +} + +#endif + +#endif diff --git a/pointer/unique_ref.h b/pointer/unique_ref.h index bee77221..1cc2120f 100644 --- a/pointer/unique_ref.h +++ b/pointer/unique_ref.h @@ -5,6 +5,7 @@ #include #include #include "../macros.h" +#include "gcc_4_8_compatibility.h" #include "cast.h" namespace cpputils {