Mihail Konstantinov wrote:
One more question about the syntax. You cited http://www.boost.org/doc/libs/1_37_0/libs/python/doc/v2/class.html#class_-spec which specifies the syntax as "class_<T,Bases,HeldType,NonCopyable>" so that I thought I have to include all 4 template arguments. But when I used instead of the above (working!) solution:
    class_<A, bases<>, A, boost::noncopyable> a("A",init<>());
    class_<B, bases<A>, B, boost::noncopyable >("B",init<>());
I get the error:
/home/mihail/temporary/boost_1_37_0/boost/python/object/value_holder.hpp:159: 
error: no matching function for call to
‘B::B(PyObject*&)’
boost.cpp:13: note: candidates are: B::B()
boost.cpp:11: note:                 B::B(const B&)

Why does the abbreviated template argument list work, and why not the complete 
argument list?

As the docs say, all but the first template argument are optional. And, thanks to some meta-programming magic, their order doesn't matter. The above link also discusses requirements on the HeldType, such as "its exposed constructor(s) must accept an initial |PyObject*| argument..."

Again, may not actually need to care about the HeldType if the defaults work fine for you.

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