[Issue 4287] New: opOpAssign!("~=") for std.array.Appender

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 6 08:40:04 PDT 2010


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

           Summary: opOpAssign!("~=") for std.array.Appender
           Product: D
           Version: future
          Platform: Other
        OS/Version: Windows
            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-06 08:40:02 PDT ---
In std.array.Appender I'd like to use opOpAssign!("~=") instead of the put()
member function. Is this possible? This is handy because in some situations I
can almost replace a dynamic array with an Appender, keeping the same appends
~= unchanged in the code.

std.array.Appender can even support two more operations (with complexity O(n ln
n) or better) that I have found sometimes useful in my D1 code that uses a
struct similar to Appender (but this is less important. Such operations can be
allowed even if Appender gets implemented for example with a deque data
structure):

- length attribute
- opIndex()

An Appender is not an array, so it's better to not support opIndexAssign or
opIndexOpAssign, etc. But peeking inside the Appender data structure with an
opIndex() can be sometimes useful and avoids converting the Appender to a whole
new array (that can be a costly operation if Appender changes its data
structure implementation).

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