[C++-sig] Data members and inheritance

Kerim Borchaev warkid at hotbox.ru
Mon Nov 11 10:57:02 CET 2002


Hello.

I'm trying to export a class's data member that's declared in parent
class. But I can't. Please explain me what am I doing wrong.

Here's the test code:

//hello.cpp
#include <boost/python.hpp>
using namespace boost::python;

struct t {
    float a;
};

struct xt : t {
};

BOOST_PYTHON_MODULE(hello)
{
    class_<xt>("xt", no_init)
        .def_readonly("a", &xt::a);
}
///////////////////

compiling it I get this error:

hello.cpp(16) : error C2784: 'boost::python::class_<T,X1,X2,X3>::self &boost::py
thon::class_<T,X1,X2,X3>::def_readonly(const char *,D xt::* )' : could not deduc
e template argument for ' xt::* ' from 'float t::* '
        with
        [
            T=xt,
            X1=boost::python::detail::not_specified,
            X2=boost::python::detail::not_specified,
            X3=boost::python::detail::not_specified
        ] 
  

Best regards,
 Kerim                          mailto:warkid at hotbox.ru



------------------
Get free mailbox 20 Mb at http://www.hotbox.ru


More information about the Cplusplus-sig mailing list