[Issue 4420] insertBack() for SList

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 4 03:38:31 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4420



--- Comment #4 from Jonathan M Davis <jmdavisProg at gmail.com> 2010-07-04 03:38:29 PDT ---
Ah. Good point. I obviously didn't think that one through thoroughly enough.
You could popBack() once, but that would be it. Scratch that idea.

However, you could still have insertBack() and back() if you kept track of the
last element. back() would return that last element and insertBack() would
insert after it, adjusting the last element's pointer to its next element to
point to the new last element and adjusting the container's pointer to the last
element to point to the new last element. So, that should work in O(1), but no
popBack() wouldn't work.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list