Re: C Level Iterators and Userland Classes

From: Date: Fri, 17 Feb 2006 08:18:51 +0000
Subject: Re: C Level Iterators and Userland Classes
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-21897@lists.php.net to get a copy of this message
Hello l0t3k, in SPL the iterator classes can be overloaded in TextIterator not. Foreach does what is necccessary and especially if inside foreach() someone uses the value it is being copied automatically. Since you do it all yourself you also need to do the copying yourself. So there is no inconsistency, just diiferent usage. regards marcus Friday, February 17, 2006, 1:09:37 AM, you wrote: > Marcus, > one last question ... >> You should never touch the data member of that iterator > does this mean that i should make a copy of whatever i get from > the get_current_data() handler ? There seems to be a bit of inconsistency > in dealing with the current element in the iterators For example, the > TextIterator > reuses the same zval value, whereas the classes in SPL call zval_ptr_dtor() > between iterations. > clayton Best regards, Marcus

« previous php.internals (#21897) next »