digitalmars.D.learn - Error instantiating std.container.Array
- Francesco Cattoglio (26/26) Mar 02 2015 I'm trying to instantiate a std.container.Array of a given class
- Tobias Pankrath (6/32) Mar 02 2015 Try to reduce your Material class for a small failing example.
- Francesco Cattoglio (21/25) Mar 02 2015 I'm still trying now, with no luck.
- ketmar (3/3) Mar 02 2015 On Mon, 02 Mar 2015 14:40:50 +0000, Francesco Cattoglio wrote:
- Francesco Cattoglio (7/10) Mar 02 2015 I tried to "dub dustmite", but it failed with a
- Tobias Pankrath (2/3) Mar 02 2015 Something is wrong with your Material class, but you'll need to
- Francesco Cattoglio (10/13) Mar 02 2015 After a really long time I finally found what was wrong.
- Tobias Pankrath (4/18) Mar 02 2015 .init is a special property of every type:
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (4/17) Mar 02 2015 Existing issue:
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)
Mar 02 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.
Mar 02 2015
On Monday, 2 March 2015 at 14:14:19 UTC, Tobias Pankrath wrote: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.I'm still trying now, with no luck. I also tried to get a Material[] instead of an Array!Material. It compiles, but when I call std.algorithm.sort on it I get another funny error, which apparently not even google can find except for one lonely test unit: C:\D\dmd2\windows\bin\..\..\src\phobos\std\range.d(2222): Error: cannot have parameter of function type void() C:\D\dmd2\windows\bin\..\..\src\phobos\std\range.d(2278): Error: cannot have parameter of function type void() C:\D\dmd2\windows\bin\..\..\src\phobos\std\range.d(2306): Error: cannot have parameter of function type void() Following a few more lines concerning who tried to instantiate it: ....\src\phobos\std\range.d(8385): Error: template instance std.range.stride!(Material[]) error instantiating ....\src\phobos\std\algorithm.d(9383): instantiated from here: SortedRange!(Material[], "a.step < b.step") ....\material.d(15): instantiated from here: sort!("a.step < b.step", cast (SwapStrategy)0, Material[]) (".step" is a class member variable, it's a simple int) I'm really clueless... :P
Mar 02 2015
On Mon, 02 Mar 2015 14:40:50 +0000, Francesco Cattoglio wrote: did you tried to dustmite[1] it? [1] https://github.com/CyberShadow/DustMite/wiki=
Mar 02 2015
On Monday, 2 March 2015 at 14:46:31 UTC, ketmar wrote:On Mon, 02 Mar 2015 14:40:50 +0000, Francesco Cattoglio wrote: did you tried to dustmite[1] it? [1] https://github.com/CyberShadow/DustMite/wikiI tried to "dub dustmite", but it failed with a "object.Exception DustMite\dustmite.d(220): Initial test fails" The dustmite version is the one that was bundled with dmd 2.066.1-rc2. I'll update dmd in the mean time, but I have a feeling that this is not related.
Mar 02 2015
I'm really clueless... :PSomething is wrong with your Material class, but you'll need to show us a reduced example.
Mar 02 2015
On Monday, 2 March 2015 at 15:01:55 UTC, Tobias Pankrath wrote:After a really long time I finally found what was wrong. http://dpaste.dzfl.pl/16d202b7124d Wow, I honestly could have NEVER foreseen this. This is all it takes for a class being unusable in a std.container.Array class MyClass { void init(); }I'm really clueless... :PSomething is wrong with your Material class, but you'll need to show us a reduced example.
Mar 02 2015
On Monday, 2 March 2015 at 15:14:49 UTC, Francesco Cattoglio wrote:On Monday, 2 March 2015 at 15:01:55 UTC, Tobias Pankrath wrote:.init is a special property of every type: http://dlang.org/property.html#initAfter a really long time I finally found what was wrong. http://dpaste.dzfl.pl/16d202b7124d Wow, I honestly could have NEVER foreseen this. This is all it takes for a class being unusable in a std.container.Array class MyClass { void init(); }I'm really clueless... :PSomething is wrong with your Material class, but you'll need to show us a reduced example.
Mar 02 2015
On 03/02/2015 07:14 AM, Francesco Cattoglio wrote:On Monday, 2 March 2015 at 15:01:55 UTC, Tobias Pankrath wrote:Existing issue: https://issues.dlang.org/show_bug.cgi?id=12545 AliAfter a really long time I finally found what was wrong. http://dpaste.dzfl.pl/16d202b7124d Wow, I honestly could have NEVER foreseen this. This is all it takes for a class being unusable in a std.container.Array class MyClass { void init(); }I'm really clueless... :PSomething is wrong with your Material class, but you'll need to show us a reduced example.
Mar 02 2015









"Francesco Cattoglio" <francesco.cattoglio gmail.com> 