Fix the std_shared_ptr example

This commit is contained in:
Gustavo Carneiro committed 2020-10-04 16:10:27 +01:00
1 parent bb50384ea2
commit b787885ade
1 file changed
+3 -2
+3 -2
View File
@@ -12,6 +12,7 @@ from pybindgen import Module, FileCodeSink, param, retval
#from pybindgen.function import CustomFunctionWrapper
#from pybindgen.cppmethod import CustomCppMethodWrapper
from pybindgen import cppclass
from pybindgen.typehandlers.smart_ptr import StdSharedPtr
#from pybindgen import param, retval
@@ -25,7 +26,7 @@ def my_module_gen(out_file):
mod.add_include ('"sp.h"')
Foo = mod.add_class('Foo', memory_policy=cppclass.SharedPtr('::Foo'))
Foo = mod.add_class('Foo', memory_policy=StdSharedPtr('::Foo'))
Foo.add_constructor([param('std::string', 'datum')])
Foo.add_constructor([])
@@ -37,7 +38,7 @@ def my_module_gen(out_file):
[param('std::shared_ptr<Foo>', 'foo')])
mod.add_function('function_that_returns_foo', retval('std::shared_ptr<Foo>'), [])
## ---- finally, generate the whole thing ----
mod.generate(FileCodeSink(out_file))