www.digitalmars.com         C & C++   DMDScript  

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

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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Mar 08 2014