From 3bf9066215d349cd13d981f49476d41d976e978d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 22 Apr 2026 17:34:21 +0100 Subject: [PATCH] Added clone method for meta data. --- include/vsg/core/Object.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/vsg/core/Object.h b/include/vsg/core/Object.h index b29a643b36..242ff12380 100644 --- a/include/vsg/core/Object.h +++ b/include/vsg/core/Object.h @@ -283,4 +283,15 @@ namespace vsg return new_object.template cast(); } + /// clone a named meta data object stored within an object's Auxliary object if available, others default construct object + template + ref_ptr clone(const std::string& key, C container) + { + if (container) + { + if (auto prototype = container->template getRefObject(key)) return vsg::clone(prototype); + } + return T::create(); + } + } // namespace vsg