[Issue 1855] New: .dup property for value types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 20 07:34:27 PST 2008


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

           Summary: .dup property for value types
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: aarti at interia.pl


There should be .dup property also for all built-in value types (char, int
etc.)

It will allow greater consistency in generic programming. Currently changing
type from e.g. string to char you have to change also implementation of
duplicating method:

struct StringDescription {
    public:
        string delimiter = "MYDELIM"; //char delimiter = '"'; dup() has error

        typeof(*this) dup() {
            typeof(*this) result;
            result.delimiter = delimiter.dup;
            return result;
        }
    }

It shouldn't be very difficult to implement this enhancement as .dup for values
can be simply ignored.


-- 



More information about the Digitalmars-d-bugs mailing list