Roland Schulz wrote:
> Hi,
> 
> is it possible (or planned) to add operators to a ctypdef struct?

Better C++ support is definitely planned; in fact there is a GSoC 
project on it where this could likely be a part (though Danilo or Robert 
would have to comment on that).

I started a wiki page listing the things that could be improved for C++ 
support and

http://wiki.cython.org/enhancements/cpp

but I became exhausted right before fixing up the operator overloading 
section; perhaps you could have a look and come with suggestions?

Especially, I'm concerned with operators typically returning references 
like operator[]:

cdef struct Polygon:
     Point& operator[](int edge)

where one would like to be able to do

mypoly[3] = mypoint

However this also contradicts the scetched solution for dealing with 
references which means having Cython treat references as pointers; 
making it necesarry to do

mypoly[3][0] = mypoint

Perhaps some map between Python's __setitem__ and reference return 
values in C++ operator[], but it gets messy syntax-wise quickly...

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to