Skip to content

Commit c731f26

Browse files
committed
memory.h file created, upstream backport.
1 parent 922a831 commit c731f26

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/util/memory.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) 2009-2010 Satoshi Nakamoto
2+
// Copyright (c) 2009-2018 The Bitcoin Core developers
3+
// Distributed under the MIT software license, see the accompanying
4+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
6+
#ifndef BITCOIN_UTIL_MEMORY_H
7+
#define BITCOIN_UTIL_MEMORY_H
8+
9+
#include <memory>
10+
#include <utility>
11+
12+
//! Substitute for C++14 std::make_unique.
13+
template <typename T, typename... Args>
14+
std::unique_ptr<T> MakeUnique(Args&&... args)
15+
{
16+
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
17+
}
18+
19+
#endif

0 commit comments

Comments
 (0)