Skip to content

Commit 09a1875

Browse files
committed
miniscript: Make NodeRef a unique_ptr
There's no need for it to be a shared_ptr.
1 parent 9ccb46f commit 09a1875

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/script/miniscript.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ inline consteval Type operator""_mst(const char* c, size_t l)
189189
using Opcode = std::pair<opcodetype, std::vector<unsigned char>>;
190190

191191
template<typename Key> struct Node;
192-
template<typename Key> using NodeRef = std::shared_ptr<const Node<Key>>;
192+
template<typename Key> using NodeRef = std::unique_ptr<const Node<Key>>;
193193

194-
//! Construct a miniscript node as a shared_ptr.
194+
//! Construct a miniscript node as a unique_ptr.
195195
template<typename Key, typename... Args>
196-
NodeRef<Key> MakeNodeRef(Args&&... args) { return std::make_shared<const Node<Key>>(std::forward<Args>(args)...); }
196+
NodeRef<Key> MakeNodeRef(Args&&... args) { return std::make_unique<const Node<Key>>(std::forward<Args>(args)...); }
197197

198198
//! The different node types in miniscript.
199199
enum class Fragment {

0 commit comments

Comments
 (0)