[C++-sig] Re: simple array access?

Dusty Leary dleary at ttlc.net
Tue Dec 23 08:45:04 CET 2003


Sorry for previous message, I typoed and sent it...

I would like to expose a C++ array "naturally" to python.

class myclass {
    int myarray[42];
}


class_<myclass>("myclass")
    .def_readwrite("myarray", &myclass::myarray)
    ;

is this sort of thing possible in boost.python?

do we have to make our own to_python/from_python handlers?

even with these handlers, I don't think it would be possible to do from
python:

myclassinstance.myarray[40] = 9

or am I mistaken?





More information about the Cplusplus-sig mailing list