[Issue 15982] New: std.array.array treats dynamic arrays as input ranges and allocates new memory

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 2 00:55:40 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15982

          Issue ID: 15982
           Summary: std.array.array treats dynamic arrays as input ranges
                    and allocates new memory
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: sigod.mail at gmail.com

import std.array : array;
    int[] a = [1, 2, 3];
    assert(a.ptr == array(a).ptr); // fails

I think for dynamic arrays `array()` should just return provided value without
doing anything.

--


More information about the Digitalmars-d-bugs mailing list