[Issue 12323] New: std.typecons.Nullable of a fixed-size array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 8 14:11:38 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12323

           Summary: std.typecons.Nullable of a fixed-size array
           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 2014-03-08 14:11:36 PST ---
This is an enhancement request, related to Issue 12322


import std.range: iota;
import std.array: array;
import std.typecons: Nullable;
alias Foo = int[5];
Nullable!Foo bar1() {
    Foo r = 5.iota.array;
    return typeof(return)(r); // OK
}
Nullable!Foo bar2() {
    return typeof(return)(5.iota.array); // Error
}
Nullable!Foo bar3() {
    return typeof(return)(5.iota.array.idup); // Error
}
void main() {}


dmd 2.066alpha gives:

test.d(10,26): Error: inout method std.typecons.Nullable!(int[5]).Nullable.this
is not callable using a mutable object
test.d(13,26): Error: inout method std.typecons.Nullable!(int[5]).Nullable.this
is not callable using a mutable object


Is it possible to support code like in the function bar2()?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list