Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | Implement function as wrapper for std::make_unique |
| 2 | method to be compatible with gcc < 4.9 . |
| 3 | "error::make_unique is not a member of 'std'" |
| 4 | |
| 5 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> |
| 6 | Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> |
| 7 | |
| 8 | diff -Naur node-v10.15.1/src/cares_wrap.cc node-v10.15.1/src/cares_wrap.cc |
| 9 | --- node-v10.15.1/src/cares_wrap.cc 2019-01-29 08:20:50.000000000 +0100 |
| 10 | +++ node-v10.15.1/src/cares_wrap.cc 2019-02-21 16:22:25.489131665 +0100 |
| 11 | @@ -52,6 +52,16 @@ |
| 12 | # define AI_V4MAPPED 0 |
| 13 | #endif |
| 14 | |
| 15 | +#ifndef __cpp_lib_make_unique |
| 16 | +namespace std { |
| 17 | + /// make_unique implementation |
| 18 | + template<typename T, typename... Args> |
| 19 | + std::unique_ptr<T> make_unique(Args&&... args) { |
| 20 | + return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); |
| 21 | + } |
| 22 | +} |
| 23 | +#endif |
| 24 | + |
| 25 | namespace node { |
| 26 | namespace cares_wrap { |
| 27 | |
| 28 | diff -Naur node-v10.15.1/src/inspector_agent.cc node-v10.15.1/src/inspector_agent.cc |
| 29 | --- node-v10.15.1/src/inspector_agent.cc 2019-01-29 08:20:50.000000000 +0100 |
| 30 | +++ node-v10.15.1/src/inspector_agent.cc 2019-02-21 16:22:09.000185992 +0100 |
| 31 | @@ -24,6 +24,16 @@ |
| 32 | #include <pthread.h> |
| 33 | #endif // __POSIX__ |
| 34 | |
| 35 | +#ifndef __cpp_lib_make_unique |
| 36 | +namespace std { |
| 37 | + /// make_unique implementation |
| 38 | + template<typename T, typename... Args> |
| 39 | + std::unique_ptr<T> make_unique(Args&&... args) { |
| 40 | + return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); |
| 41 | + } |
| 42 | +} |
| 43 | +#endif |
| 44 | + |
| 45 | namespace node { |
| 46 | namespace inspector { |
| 47 | namespace { |
| 48 | |
| 49 | diff --git a/src/inspector/main_thread_interface.cc b/src/inspector/main_thread_interface.cc |
| 50 | index e374c0fd70..05d7d8c60f 100644 |
| 51 | --- a/src/inspector/main_thread_interface.cc |
| 52 | +++ b/src/inspector/main_thread_interface.cc |
| 53 | @@ -6,6 +6,16 @@ |
| 54 | #include <functional> |
| 55 | #include <unicode/unistr.h> |
| 56 | |
| 57 | +#ifndef __cpp_lib_make_unique |
| 58 | +namespace std { |
| 59 | + /// make_unique implementation |
| 60 | + template<typename T, typename... Args> |
| 61 | + std::unique_ptr<T> make_unique(Args&&... args) { |
| 62 | + return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); |
| 63 | + } |
| 64 | +} |
| 65 | +#endif |
| 66 | + |
| 67 | namespace node { |
| 68 | namespace inspector { |
| 69 | namespace { |