diff options
| author | practicalswift <[email protected]> | 2017-08-15 06:59:08 +0200 |
|---|---|---|
| committer | practicalswift <[email protected]> | 2017-11-09 16:53:34 +0100 |
| commit | 86179897e230d8e5244fa7690ae1bc84b7958b9b (patch) | |
| tree | 586dd9551d2b5bfb01e25ccdd6a33c1e6b389e26 /src | |
| parent | Use unique_ptr for pcoinscatcher/pcoinsdbview/pcoinsTip/pblocktree (diff) | |
| download | discoin-86179897e230d8e5244fa7690ae1bc84b7958b9b.tar.xz discoin-86179897e230d8e5244fa7690ae1bc84b7958b9b.zip | |
Add MakeUnique (substitute for C++14 std::make_unique)
From @ryanofsky:s #10973. Thanks!
Diffstat (limited to 'src')
| -rw-r--r-- | src/util.h | 7 |
1 files changed, 7 insertions, 0 deletions
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 <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 |