Add MakeUnique (substitute for C++14 std::make_unique)

From @ryanofsky:s #10973. Thanks!
This commit is contained in:
practicalswift 2017-08-15 06:59:08 +02:00
parent d223bc940a
commit 86179897e2
1 changed files with 7 additions and 0 deletions

View File

@ -326,4 +326,11 @@ template <typename Callable> void TraceThread(const char* name, Callable func)
std::string CopyrightHolders(const std::string& strPrefix);
//! Substitute for C++14 std::make_unique.
template <typename T, typename... Args>
std::unique_ptr<T> MakeUnique(Args&&... args)
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif // BITCOIN_UTIL_H