Skip to content

Commit

Permalink
Add MakeUnique (substitute for C++14 std::make_unique)
Browse files Browse the repository at this point in the history
From @ryanofsky:s #10973. Thanks!
  • Loading branch information
practicalswift committed Nov 9, 2017
1 parent d223bc9 commit 8617989
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/util.h
Expand Up @@ -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

0 comments on commit 8617989

Please sign in to comment.