[C++-sig] Re: Howto wrap operator[]? (boost::python)
David Abrahams
dave at boost-consulting.com
Fri Jun 13 23:13:28 CEST 2003
"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> writes:
> --- "Neal D. Becker" <nbecker at hns.com> wrote:
>> I am playing with exposing std::vector<double>. So far I got init OK, now I
>> want to expose operator[]. I don't see anything in the tutorial about
>> this. Any hints?
>
> http://www.python.org/cgi-bin/moinmoin/boost_2epython_2fStlContainers
I should point out that wrapping iterators explicitly is unneccessary
(and less safe) then letting Python generate iterators automatically
using your __getitem__ for zero-based integer-indexed containers.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list