Skip to content

Commit 3bf9066

Browse files
committed
Added clone method for meta data.
1 parent c4750ff commit 3bf9066

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

include/vsg/core/Object.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,15 @@ namespace vsg
283283
return new_object.template cast<T>();
284284
}
285285

286+
/// clone a named meta data object stored within an object's Auxliary object if available, others default construct object
287+
template<class T, class C>
288+
ref_ptr<T> clone(const std::string& key, C container)
289+
{
290+
if (container)
291+
{
292+
if (auto prototype = container->template getRefObject<T>(key)) return vsg::clone(prototype);
293+
}
294+
return T::create();
295+
}
296+
286297
} // namespace vsg

0 commit comments

Comments
 (0)