Re: Using RefCounted in recursive structures and templates

2016-05-11 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 22:10:06 UTC, ag0aep6g wrote: Am 10.05.2016 um 21:43 schrieb Lodovico Giaretta: import std.typecons: RefCounted; struct S { RefCounted!S s; // error: struct S no size yet for forward reference } This used to work with 2.067. I've filed a phobos regression fo

Re: Using RefCounted in recursive structures and templates

2016-05-10 Thread ag0aep6g via Digitalmars-d-learn
Am 10.05.2016 um 21:43 schrieb Lodovico Giaretta: alias Node(T) = RefCounted!(_Node!T); struct _Node(T) { Node!T parent; // error: recursive template expansion } I think this is expected. Can't have cycles like that in template instantiations.

Re: Using RefCounted in recursive structures and templates

2016-05-10 Thread ag0aep6g via Digitalmars-d-learn
Am 10.05.2016 um 21:43 schrieb Lodovico Giaretta: import std.typecons: RefCounted; struct S { RefCounted!S s; // error: struct S no size yet for forward reference } This used to work with 2.067. I've filed a phobos regression for this very code, and two related dmd issues with different

Using RefCounted in recursive structures and templates

2016-05-10 Thread Lodovico Giaretta via Digitalmars-d-learn
Hi, I'm trying to use std.typecons.RefCounted on recursive structures to emulate garbage-collected classes, but it doesn't work, because the RefCounted implementation ends up creating a cycle in the structure hierarchy. import std.typecons: RefCounted; struct S { RefCounted!S s; // erro