Andrej Mitrovic wrote:
>I'm don't understand why this code calls the dtor before it calls the
>ctor:
>
>import std.stdio;
>import std.typecons;
>
>void main()
>{
>auto wrap1 = Wrapper(1);
>}
>
>void free(ref int _payload)
>{
>writeln("dealloc");
>_payload = 0;
>}
>
>struct Wrapper
>{
>
I'm don't understand why this code calls the dtor before it calls the ctor:
import std.stdio;
import std.typecons;
void main()
{
auto wrap1 = Wrapper(1);
}
void free(ref int _payload)
{
writeln("dealloc");
_payload = 0;
}
struct Wrapper
{
struct Payload
{
int _payloa
Jesse Phillips wrote:
>I don't really think stdio is the place to see modern D ref counting.
>The container class has an Array which is built to use RefCounted. I
>had tried my and at explaining how to use it: http://stackoverflow.com/
>questions/4632355/making-a-reference-counted-object-in-d-using
Jesse Phillips wrote:
>I don't really think stdio is the place to see modern D ref counting.
>The container class has an Array which is built to use RefCounted. I
>had tried my and at explaining how to use it: http://stackoverflow.com/
>questions/4632355/making-a-reference-counted-object-in-d-using
I don't really think stdio is the place to see modern D ref counting. The
container class has an Array which is built to use RefCounted. I had
tried my and at explaining how to use it: http://stackoverflow.com/
questions/4632355/making-a-reference-counted-object-in-d-using-
refcountedt/4635050#46
I have some problems understanding the reference counting code in
std.stdio. The reduced code my questions refer to is here:
https://gist.github.com/1099229
(ignore the not-working struct default constructor, that's just to
simplify the code)
in line 5: why is 'refs' initialized to 'uint.max / 2'?