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 {