Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile)

Timon Gehr timon.gehr at gmx.ch
Fri Nov 9 14:45:27 PST 2012


On 11/09/2012 10:32 PM, Manfred Nowak wrote:
> Timon Gehr wrote:
>
>> The example definitely exposes a bug in DMD.
>> The D front end I am developing can already handle it.
>
> May I guess, that your front end is also able to handle this code:
>
> struct Elem( size_t myNumber) {
>    Elem!( myNumber +1)* next;
> }
> void main(){
>    Elem!0 list;
>    list.next= new Elem!1;
> }
>
> -manfred
>

In theory yes, but it takes a long time and uses a lot of memory, 
especially on a 64 bit build. This is a very different example from the 
OT's though.


More information about the Digitalmars-d-learn mailing list