[C++-sig] wrapping 2D arrays with boost::python

Marko Skace brdavs at yahoo.com
Wed Oct 4 20:30:22 CEST 2006


I would like to wrap a a fixed 2-dimensional array
with boost::python.

Example:

class Array2
{

public:

float* operator[]( int i ) { return data[i]; }

private:

float data[4][4];

};

I want to wrap this code such that __getitem__ and
__setitem__ will work:

array[2][3] = 1.0;


Any suggestions and pointers are appreciated.

Marko

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Cplusplus-sig mailing list