Skip to content

Commit

Permalink
[cppbinding] classParam<T> now keeps ownership of the shared_ptr for … (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
3dJan authored and gangatp committed Dec 11, 2024
1 parent 8d34c9f commit d5d717c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/buildbindingccpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -1224,16 +1224,17 @@ func getCPPInheritanceSpecifier(component ComponentDefinition, class ComponentDe
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("")
Expand Down

0 comments on commit d5d717c

Please sign in to comment.