diff --git a/include/vsg/core/Object.h b/include/vsg/core/Object.h index b29a643b3..242ff1238 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