[Issue 4348] New: std.container.SList append

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 19 12:52:06 PDT 2010


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

           Summary: std.container.SList append
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-06-19 12:52:03 PDT ---
This shows how you can append to a std.container.SList:

import std.container: SList;
void main() {
    auto l = SList!int(1, 2);
    l.insertAfter(l[], 3);
}


But the standard D syntax too can be supported, despite it's O(n):

import std.container: SList;
void main() {
    auto l = SList!int(1, 2);
    l ~= 3;
}


(The member function "insertFront" might be named "prepend", that is shorter ,
equally readable and contains no upper case letters).

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