From 06f9086d0c9ec906570076b4b6ed6ed05e2fa976 Mon Sep 17 00:00:00 2001 From: 3dJan <56254096+3dJan@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:19:05 +0100 Subject: [PATCH] =?UTF-8?q?[cppbinding]=20classParam<T>=20now=20keeps=20ow?= =?UTF-8?q?nership=20of=20the=20shared=5Fptr=20for=20=E2=80=A6=20(#212)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [cppbinding] classParam<T> now keeps ownership of the shared_ptr for its own lifetime * restore previous formatting of writeClassParamDefinition * reducing white space changes to make the diff more comprehensive --- Source/buildbindingccpp.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/buildbindingccpp.go b/Source/buildbindingccpp.go index 5995eae2..c54855f8 100644 --- a/Source/buildbindingccpp.go +++ b/Source/buildbindingccpp.go @@ -1207,16 +1207,17 @@ func writeClassParamDefinition(w LanguageWriter, NameSpace string) { w.Writeln("") w.Writeln("template<class T> class classParam {") w.Writeln("private:") + w.Writeln(" std::shared_ptr<T> m_sharedPtr;") w.Writeln(" const T* m_ptr;") w.Writeln("") w.Writeln("public:") w.Writeln(" classParam(const T* ptr)") - w.Writeln(" : m_ptr (ptr)") + w.Writeln(" : m_ptr(ptr)") w.Writeln(" {") w.Writeln(" }") w.Writeln("") w.Writeln(" classParam(std::shared_ptr <T> sharedPtr)") - w.Writeln(" : m_ptr (sharedPtr.get())") + w.Writeln(" : m_sharedPtr(sharedPtr), m_ptr(sharedPtr.get())") w.Writeln(" {") w.Writeln(" }") w.Writeln("")