Error instantiating std.container.Array

2015-03-02 Thread Francesco Cattoglio via Digitalmars-d-learn
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

Re: Error instantiating std.container.Array

2015-03-02 Thread Francesco Cattoglio via Digitalmars-d-learn
On Monday, 2 March 2015 at 14:46:31 UTC, ketmar wrote: On Mon, 02 Mar 2015 14:40:50 +, Francesco Cattoglio wrote: did you tried to dustmite[1] it? [1] https://github.com/CyberShadow/DustMite/wiki I tried to dub dustmite, but it failed with a object.Exception@DustMite\dustmite.d(220):

Re: Error instantiating std.container.Array

2015-03-02 Thread Francesco Cattoglio via Digitalmars-d-learn
On Monday, 2 March 2015 at 15:01:55 UTC, Tobias Pankrath wrote: I'm really clueless... :P Something is wrong with your Material class, but you'll need to show us a reduced example. After a really long time I finally found what was wrong. http://dpaste.dzfl.pl/16d202b7124d Wow, I honestly

Re: A naive attempt at a refcounted class proxy

2015-01-15 Thread Francesco Cattoglio via Digitalmars-d-learn
On Tuesday, 13 January 2015 at 18:52:25 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 13 Jan 2015 18:36:15 + aldanor via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Tuesday, 13 January 2015 at 18:19:42 UTC, ketmar via Digitalmars-d-learn wrote: and then you can

-inline switch changes code behaviour

2014-08-23 Thread francesco cattoglio via Digitalmars-d-learn
Today I just realized that in DMD optimize flag does not imply inlining, therefore I promptly added the inline to my dub build settings and recompiler, expecting to see speedups in my code execution. To my surprise, I could not see anything at all: all that I get now is a blank screen. The

Get the default hash function.

2014-07-31 Thread francesco cattoglio via Digitalmars-d-learn
Really simple question: how do I get the compiler-generated hash function for a given type? For example: Struct S { int i; } can be used in an associative array. That means the compiler generates a toHash function. Is there any simple way to call it directly?

Type deduction on templated constructor.

2014-07-24 Thread francesco cattoglio via Digitalmars-d-learn
So, I have this code (also on http://dpaste.dzfl.pl/3f767b17e83c) This Vector(T) struct is taken from gfm.math.vector. struct Vector(T) { T x, y, z; this(X : T, Y : T, Z : T)(X x_, Y y_, Z z_) { x = x_; y = y_; z = z_; } } void main() {

Re: Type deduction on templated constructor.

2014-07-24 Thread francesco cattoglio via Digitalmars-d-learn
On Thursday, 24 July 2014 at 09:38:14 UTC, bearophile wrote: francesco cattoglio: should this code compile? I understand that the literal 1 is int therefore it can screw type deduction, but I wonder if the compiler should be smart enough to deduce it correctly. To keep both the compiler and

Re: core.exception.InvalidMemoryOperationError

2014-07-11 Thread francesco cattoglio via Digitalmars-d-learn
On Friday, 11 July 2014 at 11:43:44 UTC, Joakim wrote: On Thursday, 10 July 2014 at 15:36:53 UTC, francesco cattoglio wrote: A code I'm working on stops working and starts printing an infinite loop of core.exception.InvalidMemoryOperationError to the command line output. The code is quite

core.exception.InvalidMemoryOperationError

2014-07-10 Thread francesco cattoglio via Digitalmars-d-learn
A code I'm working on stops working and starts printing an infinite loop of core.exception.InvalidMemoryOperationError to the command line output. The code is quite complex and the bug seems to present itself almost in random situation so I would like to try to understand the issue better

Re: What exactly module in D means?

2014-07-05 Thread Francesco Cattoglio via Digitalmars-d-learn
On Saturday, 5 July 2014 at 17:08:01 UTC, Olivier Pisano wrote: No, import is different from include. It does not stupidly copy and paste its content but tells the compiler to take the module into account for name resolution. The result may seem similar, but is much more efficient. In fact,

Re: how to correctly 'typedef' handle types

2014-06-20 Thread francesco cattoglio via Digitalmars-d-learn
http://dlang.org/phobos/std_typecons.html#Typedef Take a look at it. Docs is scarce (pretty sure you will need to take a look around to find something) but it should just do what you need.

Differences between const Type function() and const(Type) function()

2014-05-30 Thread francesco cattoglio via Digitalmars-d-learn
Today I got the following compile error: Cannot implicitly convert expression (blabla) of type const(Type) to Type and this is a reduced example ( also on http://dpaste.dzfl.pl/f2f3bd921989): module test; import std.stdio; class Foo { int i = 42; } class MyClass {

Re: Differences between const Type function() and const(Type) function()

2014-05-30 Thread francesco cattoglio via Digitalmars-d-learn
On Friday, 30 May 2014 at 12:57:52 UTC, anonymous wrote: And why is const(Foo) getQ so much different? (e.g: this is an explicit cast, right? Is there anything that might go wrong?) It's not a cast. It's the unambiguous notation for a qualified type. Often you can omit the parentheses. With

Re: Programming a Game in D? :D

2014-05-28 Thread Francesco Cattoglio via Digitalmars-d-learn
On Wednesday, 28 May 2014 at 17:46:23 UTC, David wrote: Ok, now I just wonder wich Engine. (I know everybody hates the discussion about the best engine.) CryEngine, UDK, Unity or a less known Engine? I'll be honest, perhaps I risk being misunderstood, but the questions you are asking denote a

Re: Programming a Game in D? :D

2014-05-22 Thread Francesco Cattoglio via Digitalmars-d-learn
On Thursday, 22 May 2014 at 15:48:50 UTC, John Colvin wrote: On Thursday, 22 May 2014 at 15:39:36 UTC, David wrote: Hey, I'm really new to D, and pretty new to programming overall too, But I want to make a 3d Game, (just sth. small). I really like D and want to do it in D, but in the Internet

Re: Scalar + array operations

2014-05-21 Thread Francesco Cattoglio via Digitalmars-d-learn
On Wednesday, 21 May 2014 at 13:52:47 UTC, John Colvin wrote: On Wednesday, 21 May 2014 at 11:45:57 UTC, Stefan Frijters wrote: I would have expected the last case to work as well, but I get testarr.d(20): Error: incompatible types for ((dfoo) * (ibar[])): 'double' and 'int[]' Is this by

Re: Templating everything? One module per function/struct/class/etc, grouped by package?

2014-05-12 Thread Francesco Cattoglio via Digitalmars-d-learn
On Monday, 12 May 2014 at 08:37:43 UTC, JR wrote: What am I missing? Error messages! If your code is not compiled, you can't know whether it is valid or not. I must say that since we have unittests, this is somewhat less relevant, but still... One nice thing would be stripping the