From 86179897e230d8e5244fa7690ae1bc84b7958b9b Mon Sep 17 00:00:00 2001 From: practicalswift Date: Tue, 15 Aug 2017 06:59:08 +0200 Subject: [PATCH] Add MakeUnique (substitute for C++14 std::make_unique) From @ryanofsky:s #10973. Thanks! --- src/util.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util.h b/src/util.h index 480a80c0a..43acd93ee 100644 --- a/src/util.h +++ b/src/util.h @@ -326,4 +326,11 @@ template void TraceThread(const char* name, Callable func) std::string CopyrightHolders(const std::string& strPrefix); +//! Substitute for C++14 std::make_unique. +template +std::unique_ptr MakeUnique(Args&&... args) +{ + return std::unique_ptr(new T(std::forward(args)...)); +} + #endif // BITCOIN_UTIL_H -- 2.11.4.GIT