[C++-sig] can boost::python class imlement buffer protocol? (original) (raw)
Neal Becker ndbecker2 at gmail.com
Thu Jan 8 04:05:24 CET 2009
- Previous message: [C++-sig] can boost::python class imlement buffer protocol?
- Next message: [C++-sig] can boost::python class imlement buffer protocol?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
David Abrahams wrote:
on Wed Jan 07 2009, Neal Becker <ndbecker2-AT-gmail.com> wrote:
This would require filling in tpasbuffer field in the PyTypeObject structure for the class. Is this possible? Any clue how/where this could be done? I honestly don't know the answers to these questions, sorry.
As a workaround, I currently implemented an 'as_buffer' member function. For example:
template inline object as_buffer (ublas::vector & m) { return object (handle<> (PyBuffer_FromReadWriteMemory ((void*)(&m.data()[0]), m.size()*sizeof(T)))); }
- Previous message: [C++-sig] can boost::python class imlement buffer protocol?
- Next message: [C++-sig] can boost::python class imlement buffer protocol?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]