[Cython] wrapping c++

Stefan Behnel stefan_ml at behnel.de
Wed Mar 5 08:40:05 CET 2008


Neal Becker wrote:
> Is operator the real issue here?  In the std::vector example, there is
> 'at',
> which does (almost) the same thing as operator[].  My problem is that
> both 'at' and 'operator[]' return int&, and to use them you need to
> say 'at[i]=j', which I don't know how to do in cython (except for the
> macro
> version above,  or to write additional wrapper code in more c++ headers).

If you declare a variable

    cdef int* myvar

Cython allows you to say

    myvar[5] = 1

Is that what you want?

Stefan



More information about the Cython-dev mailing list