std.conv.to!string(array), strange compile error

Relja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 14 06:40:33 PST 2015


On Saturday, 14 November 2015 at 14:30:06 UTC, anonymous wrote:
> On 14.11.2015 15:17, Relja wrote:
>> - std.conv.to!string() works on a static array, when called 
>> directly on
>> the array object, but gives the compile error when called on 
>> the
>> returning object from a function.
> [...]
>> void main() {
>>      getFloat3().to!string; // does not compile
>>      (new float[3]).to!string; // compiles
>> }
>
> `new float[3]` is not a static array. Its type is not 
> `float[3]`, it's `float[]`.

Oh, my bad, sorry. No mather, issue still stands:

float[3] array;
array.to!string; // compiles


More information about the Digitalmars-d-learn mailing list