Dag Sverre Seljebotn, 05.07.2010 13:18:
> Greg Ewing wrote:
>> toki doki wrote:
>>
>>> we need to change
>>> its definition so that dereference(foo)  produce the c++ code "
>>> &(*foo) ".
>>
>> Isn't&(*foo) always equivalent to just foo?
>>
> Not at all (in C++). * can invoke arbitrary code (operator*), which is
> used in the iterators in the standard C++ containers to denote accessing
> the value of the iterator (and an iterator is not a pointer).
>
> So&(*it) converts from std::list<int>::iterator to an int*.

So, why not have a "C++ reference type" instead of a pointer? It would 
essentially behave like a pointer and support indexing for dereferencing, 
but would not be compatible with pointers and would lead to the right code 
being generated for dereferencing and assigning.

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

Reply via email to