From:             dannel at aaronexodus dot com
Operating system: 
PHP version:      5.3.0RC2
PHP Bug Type:     Feature/Change Request
Bug description:  SplDoublyLinkedList needs an insertAfterIterator() method or 
something similar

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 bug report at http://bugs.php.net/?id=48358&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48358&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48358&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48358&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48358&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48358&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48358&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48358&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48358&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48358&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48358&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48358&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48358&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48358&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48358&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48358&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48358&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48358&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48358&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48358&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48358&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48358&r=mysqlcfg

Reply via email to