Attached is a slightly updated version, with a bit simplerimplementation of foreach_delete_current.Instead of decrementing i and then adding 1 to it when indexing thelist, it now indexes the list using a postfix decrement.