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

BBaz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 14 04:55:51 PST 2015


On Saturday, 14 November 2015 at 12:46:21 UTC, Relja wrote:
> I've got this strange compile error using 
> std.conv.to!string(double[3]) - or any static array type. It's 
> called in toString override function of a template matrix 
> class, I'm building as a D learning project.
>
> [...]

Maybe try to use a full slice after a 'static if' in case the 
template type is static array:

--
{
     ElementType!T[] something;
     static if (isStaticArray!T)
         something = value[]; // slice to get a dyn array
     else
         something = value; // already a dyn array
}
--

and you work on something when it only works on dyn array. You 
can also slice the whole static array each time the problem 
occurrs


More information about the Digitalmars-d-learn mailing list