miniscript: Make NodeRef a unique_ptr

There's no need for it to be a shared_ptr.
This commit is contained in:
Ava Chow 2024-12-30 16:14:39 -05:00
parent 3f10ee4fc4
commit 8d12b59951

View file

@ -184,11 +184,11 @@ inline consteval Type operator"" _mst(const char* c, size_t l) {
using Opcode = std::pair<opcodetype, std::vector<unsigned char>>; using Opcode = std::pair<opcodetype, std::vector<unsigned char>>;
template<typename Key> struct Node; template<typename Key> struct Node;
template<typename Key> using NodeRef = std::shared_ptr<const Node<Key>>; template<typename Key> using NodeRef = std::unique_ptr<const Node<Key>>;
//! Construct a miniscript node as a shared_ptr. //! Construct a miniscript node as a unique_ptr.
template<typename Key, typename... Args> template<typename Key, typename... Args>
NodeRef<Key> MakeNodeRef(Args&&... args) { return std::make_shared<const Node<Key>>(std::forward<Args>(args)...); } NodeRef<Key> MakeNodeRef(Args&&... args) { return std::make_unique<const Node<Key>>(std::forward<Args>(args)...); }
//! The different node types in miniscript. //! The different node types in miniscript.
enum class Fragment { enum class Fragment {