Re: [pygccxml-development] Removing copy constructor
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2010-04-13 12:01:23
|
On Tue, Apr 13, 2010 at 2:40 PM, Benoit Leveau <ben...@mo...> wrote: > Hi, > > I have a problem with a class I try to bind (how original!). I hope py++ is part of the solution. If you have comments how it could be improved - I'll be glad to get them. Some time ago I wrote "easy extending guide"( http://language-binding.net/pyplusplus/troubleshooting_guide/easy_extending_guide/easy_extending_guide.html ). Only pretty simple code could be wrapped without problems. > It has a boost::mutex member (which is non-copyable). > My class itself has no explicitely defined copy-constructor. > ==> py++ tries to access this copy-constructor in the wrapper class > copy-constructor. > > class MyClass > { > public: > MyClass(){....} > // .... > protected: > // .... > boost::mutex m_mutex; > // .... > }; > > struct MyClassWrapper : MyClass, bp::wrapper<MyClass> { > MyClassWrapper(MyClass const & arg ) : MyClass( arg ), bp::wrapper< > MyClass >() > { > // copy constructor > } > > // other stuff.... > // ... > }; > > I tried to set the class.copyable to False, but py++ still generates the > same code... > > Any clue? No. I have the following test: ( see noncopyable_to_be_exported.hpp file ) C++ code: class c_t : public boost::noncopyable{ public: static char get_c(){ return 'c'; } }; struct e_t{ virtual void do_smth() = 0; private: c_t c; }; The generated code (without tweaking) is the following: namespace bp = boost::python; struct e_t_wrapper : noncopyables::e_t, bp::wrapper< noncopyables::e_t > { virtual void do_smth( ){ bp::override func_do_smth = this->get_override( "do_smth" ); func_do_smth( ); } }; Can you provide more details? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |