aboutsummaryrefslogtreecommitdiff
path: root/src/util/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/memory.h')
-rw-r--r--src/util/memory.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/util/memory.h b/src/util/memory.h
new file mode 100644
index 0000000000..15ecf8f80d
--- /dev/null
+++ b/src/util/memory.h
@@ -0,0 +1,19 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2018 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef BITCOIN_UTIL_MEMORY_H
+#define BITCOIN_UTIL_MEMORY_H
+
+#include <memory>
+#include <utility>
+
+//! 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