Forward references and more

bearophile bearophileHUGS at
Mon Oct 12 17:04:16 PDT 2009

Ary Borenszweig:

> I can see MemoryPool!(Foo) sizeof doesn't depend at all of T.sizeof 
> because it just has a pointer.

Well, a dynamic array of pointers, but the situation is the same.

>But how do you suggest to fix the compiler to understand that?<

I don't know. I don't know enough about compilers.

> What I can see is that to know MemoryPool!(Foo).sizeof the type of the 
> alias doesn't need to be solved completely... but what would you 
> recommend the compiler to do?

To see what I can see. And terminate this little dance.
If that's not possible, then I'd like to have a syntax to give the necessary hint to the (less than smart) compiler. For example saying the size of one or both structs.

This was just an example, but it's not the first time I fall in this problem when I create data structures in D.

Bye and thank you,

More information about the Digitalmars-d-learn mailing list