[Issue 4348] std.container.SList append

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 19 15:20:45 PDT 2010


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



--- Comment #2 from bearophile_hugs at eml.cc 2010-06-19 15:20:42 PDT ---
Answer to Comment 1: thank you for your answer, I didn't know about this rule.

In arrays the append can require a full array copy, so it can be O(n), but it's
(hopefully) O(1) on amortized time.

If this rule is present and well established then you can close this bug report
(the suggestion about the "prepend" name is for you, but you can ignore it if
you don't like it).

Another possibility is to find a compromise: instead of writing something hairy
like:
s.insertAfter(s[], value)
You can use:
s.linearAppend(value)
That is less noisy and equally clear in its complexity :-)

-- 
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