Use the python special function __getitem__
So, something like this:
.def( "__getitem__", &Foo::operator[], boost::python::arg( "index" ),
boost::python::return_internal_reference<>() )
If you want your container iteratable, see the docs for boost::python::range.
Charles
On Wed, Sep 8, 2010 at
Hi,
If I have a class support operator[] and operator() for indexing purpose.
How can I wrapper it in python?
--
Junwei Zhang
Office Phone:402-472-1968
junweizhang2...@gmail.com
www.junweizhang.com
Department of Electrical Engineering
University of Nebraska-Lincoln
209N Walter Scott Engineering