Re: [pygccxml-development] Removing copy constructor
Brought to you by:
mbaas,
roman_yakovenko
From: Benoit L. <ben...@mo...> - 2010-04-13 12:11:20
|
Roman Yakovenko wrote: > 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. So far, everything is going well ;) >> 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? That's really interesting...I didn't know py++ was supposed to detect this case (when a class has a non-copyable member). I'm going to try to reproduce your example, then i'll introduce my types...hopefully at some point I'll see what's causing the problem. I'll let you know what I can find. |