From fc4a2403dabcfe978c7005ca2e8b9c9b2f5288ec Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Tue, 1 Aug 2023 12:40:27 +0300 Subject: [PATCH] Adding convenience CloneTo(..) --- tpl/macro.twig | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tpl/macro.twig b/tpl/macro.twig index 164bf85..747189e 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -54,11 +54,16 @@ public {{_self.struct_type(o)}} {{o.name}} {{_self.base_struct_class(o)}} } {{_self.comment_non_cloneable_begin(o)}} + public void CloneTo(ref {{o.name}} dst) + { + MetaSync.Clone(this, ref dst, AutogenBundle.createById); + } + public {{_self.virtual_clone(o)}} IMetaStruct clone() { - var copy = new {{o.name}}(); - MetaSync.Clone(this, ref copy, AutogenBundle.createById); - return copy; + var dst = new {{o.name}}(); + CloneTo(ref dst); + return dst; } {{_self.comment_non_cloneable_end(o)}}