Skip to content

Commit 06f9086

Browse files
authored
[cppbinding] classParam<T> now keeps ownership of the shared_ptr for … (#212)
* [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
1 parent 3d5aef3 commit 06f9086

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/buildbindingccpp.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,16 +1207,17 @@ func writeClassParamDefinition(w LanguageWriter, NameSpace string) {
12071207
w.Writeln("")
12081208
w.Writeln("template<class T> class classParam {")
12091209
w.Writeln("private:")
1210+
w.Writeln(" std::shared_ptr<T> m_sharedPtr;")
12101211
w.Writeln(" const T* m_ptr;")
12111212
w.Writeln("")
12121213
w.Writeln("public:")
12131214
w.Writeln(" classParam(const T* ptr)")
1214-
w.Writeln(" : m_ptr (ptr)")
1215+
w.Writeln(" : m_ptr(ptr)")
12151216
w.Writeln(" {")
12161217
w.Writeln(" }")
12171218
w.Writeln("")
12181219
w.Writeln(" classParam(std::shared_ptr <T> sharedPtr)")
1219-
w.Writeln(" : m_ptr (sharedPtr.get())")
1220+
w.Writeln(" : m_sharedPtr(sharedPtr), m_ptr(sharedPtr.get())")
12201221
w.Writeln(" {")
12211222
w.Writeln(" }")
12221223
w.Writeln("")

0 commit comments

Comments
 (0)