ID: 48358 Updated by: col...@php.net Reported By: dannel at aaronexodus dot com -Status: Open +Status: Assigned Bug Type: Feature/Change Request PHP Version: 5.3.0RC2 -Assigned To: +Assigned To: colder
Previous Comments: ------------------------------------------------------------------------ [2009-05-21 17:02:15] dannel at aaronexodus dot com Description: ------------ The SplDoublyLinkedList is great, but it lacks a way to insert a node somewhere in the middle of the list. One could technically extend the class and provide that functionality, but due to the fact that there seem to be [documented] data members in SplDoublyLinkedList, the only way to do it would be to find the reference node, insert the new node, and move all of the following nodes up one slot in the list, resulting in O(n) performance for an insert. I propose adding an insertAfterIterator() method which would place the new node after the current node the iterator points to. Another option could be an insertAfterArrayKey() method which would act similarly, but would find the reference node via a given array key, which might be a little more straightforward to use in code. Each should probably have an insertBefore*() counterpart as well. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48358&edit=1