Browse Source

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

From @ryanofsky:s #10973. Thanks!
0.16
practicalswift 7 years ago
parent
commit
86179897e2
  1. 7
      src/util.h

7
src/util.h

@ -326,4 +326,11 @@ template <typename Callable> void TraceThread(const char* name, Callable func) @@ -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

Loading…
Cancel
Save