Robert Bradshaw wrote:
> On May 7, 2009, at 3:39 AM, Dag Sverre Seljebotn wrote:
> 
>>>> b) it is a way to solve the construction/destruction problem with C+
>>>> + classes
>>> I'm not sure it does.
>> I am referring to having to do it[0][0], which is needed because one
>> cannot do
>>
>> cdef vector[int].iterator it
>>
>> currently.
>>
>> With my proposal you can do
>>
>> cdef vector[int].iterator it
>> print it is None # True
>> it = vec.begin()
>> while it != vec.end(): # != would go through to wrapped objects
>>    print deref(it) # it.get() with my operator proposal
>>    inc(it) # it.next() with my operator proposal
> 
> To clarify, your operator proposal is the inline C++ code chunk strings?
> 
>> which is a "solved" in my book.
> 
> No, it's pushed the problem of allocating vector[int].iterator on the  
> stack to allocating vector[int].iterator as a member of a struct.

My problem isn't at all with the technical difficulties. I'm fine with 
using placement new for stack allocation if that is the problem.

My problem is how the user semantics should look like.

Python semantics has a concept of constructors/destructors which I'm 
borrowing here to fix the semantics part. The alternative is somehow 
invent a syntax to call constructors on explicitly stack-allocated 
variables, and you seemed to reject that in the thread I started about it.

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

Reply via email to