mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 10:30:52 +00:00
util: add c++14-style MakeUnique for use with c++11
Original author: practicalswift <practicalswift@users.noreply.github.com> Cherry-picked from: 38c3f678 Github Pull Request: #3577
This commit is contained in:
parent
fcfb6e4084
commit
7d76139fdd
@ -157,6 +157,7 @@ BITCOIN_CORE_H = \
|
||||
ui_interface.h \
|
||||
undo.h \
|
||||
util.h \
|
||||
utilmemory.h \
|
||||
utilmoneystr.h \
|
||||
utiltime.h \
|
||||
utilstring.h \
|
||||
|
||||
19
src/utilmemory.h
Normal file
19
src/utilmemory.h
Normal file
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user