Error instantiating std.container.Array

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 2 06:14:18 PST 2015


On Monday, 2 March 2015 at 14:08:29 UTC, Francesco Cattoglio 
wrote:
> I'm trying to instantiate a std.container.Array of a given 
> class (named Material), by a simple
> Array!Material _myStuff;
> I get two compile errors stating the following:
>
> C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(85):
> Error: template std.algorithm.initializeAll cannot deduce 
> function from argument types !()(Material[]), candidates are:
>   C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1502):
>     std.algorithm.initializeAll(Range)(Range range)
>     if (isInputRange!Range
>       && hasLvalueElements!Range
>       && hasAssignableElements!Range)
>   C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1530):
>     std.algorithm.initializeAll(Range)(Range range)
>     if (is(Range == char[]) || is(Range == wchar[]))
> C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(825): 
> Error: template std.algorithm.copy cannot deduce function from 
> argument types !()(Range, Range), candidates are:
>   C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7808):
>     std.algorithm.copy(Range1, Range2)(Range1 source, Range2 
> target)
>     if (isInputRange!Range1 && isOutputRange!(Range2, 
> ElementType!Range1))
>
> Any idea about what might be happening? I can't give a quick 
> minimal example of the code since it is quite complex (and I 
> failed at using dustmite trying to minimize it)

Try to reduce your Material class for a small failing example. 
It's probably your constructors or opAssign or something like 
that. Anyway, it's a bug if template errors from the 
implementation bubble up, so please file a report.


More information about the Digitalmars-d-learn mailing list