Mihail Konstantinov wrote:
Hello,
I am still in the early process of learning boost.python.
I have reduced my problem to the following code:

#include <boost/python.hpp>
using namespace boost::python;
class A{
private:
  A(const A&){}; //no public copy constructor
};
class B: public A{
public:
  B(){};
};
BOOST_PYTHON_MODULE(boost_ext)
{
    class_<A>("A",init<>());
    class_<B, bases<A> >("B",init<>());
}

When running bjam on this example, I get
"boost.cpp:6: error: ‘A::A(const A&)’ is private"
as the first error among a long list of hints from the compiler.


In this case you want to tell Python that your object is non-copyable:

class_<A, noncopyable> a("A", init<>);
...

See http://www.boost.org/doc/libs/1_37_0/libs/python/doc/v2/class.html#class_-spec for details.

HTH,
      Stefan

--

     ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to