On 13 August 2015 at 10:24, MM <finjulh...@gmail.com> wrote: > I have the following class: > > class T { > }; > // T has been exposed to python with class_ > > and free function: > > void add_T( T* ); > > Ownership of the T* is taken by this C++ function. > > > If I create an instance of the python version of T, how do I "def" the > add_T function? > > def("add_T", add_T) > > fails to compile. >
Apologies. This compiled correctly. This function: const T* get_T( const std::string& name ); failed to compile. so the T pointer is owner by a container in the c++ world, it gets stored there by add_T, then the get_T returns a raw pointer to it. I want to tell python to let c++ manage it.
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig