On 02/22/2012 02:06 AM, sclytrack wrote:
On 02/22/2012 06:21 AM, Andrej Mitrovic wrote:
Hmm nevermind. The param type had to be inout, but to do that the ctor
itself has to be inout. Somehow I managed to put the inout specifier
in the wrong place when testing, I did this:
this(inout(void*) obj) { } inout
which is not the same as this:
this(inout(void*) obj) inout { }
Damn specs. Anyway it's working ok now.
I'm having trouble with inout. Do you know where those specs are? Are
there any specs?
"Inout Functions" here:
http://dlang.org/function.html
Quoting from that page: "If an inout appears in a function parameter
list, it must also appear in the return type."
At first reading, that seems to disqualify constructors. Then there is
this (the documentation for struct doesn't mention inout):
http://dlang.org/class.html
It says "These attributes apply to the hidden this parameter."
Putting 2 and 2 together we get 5. :p As Timon Gehr says, inout on a
constructor must affect the type of the newly constructed object. Kind
of like as if the constructor "returns" an object.
Ali