From 1d680fcef87cf8c50d55e74e5c12aa6cac3d86ac Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Fri, 8 Oct 2021 11:15:47 +0200 Subject: [PATCH] Make clone return a mutable object (#224) * Make clone return a mutable object * Make docstring more clear --- python/templates/macros/declarations.jinja2 | 4 ++-- python/templates/macros/implementations.jinja2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/templates/macros/declarations.jinja2 b/python/templates/macros/declarations.jinja2 index 4f83957c6..b93b35899 100644 --- a/python/templates/macros/declarations.jinja2 +++ b/python/templates/macros/declarations.jinja2 @@ -71,8 +71,8 @@ /// copy-assignment operator {{ full_type }}& operator=({{ full_type }} other); - /// support cloning (deep-copy) - {{ full_type }} clone() const; + /// create a mutable deep-copy of the object with identical relations + {{ type }} clone() const; /// destructor ~{{ full_type }}(); diff --git a/python/templates/macros/implementations.jinja2 b/python/templates/macros/implementations.jinja2 index 47be23093..86946562d 100644 --- a/python/templates/macros/implementations.jinja2 +++ b/python/templates/macros/implementations.jinja2 @@ -26,7 +26,7 @@ if (m_obj) m_obj->acquire(); } -{{ full_type }} {{ full_type }}::clone() const { +{{ type }} {{ full_type }}::clone() const { return {new {{ type }}Obj(*m_obj)}; }