Forward references and more
bearophileHUGS at lycos.com
Mon Oct 12 12:38:07 PDT 2009
> It looks strange what you are doing. A Foo can have a memory pool of a
> lot of Foo's? Do you mean to make the memory pool static?
Right and yes.
>I think that might work.<
It works if I use a global variable. But I'd like to not used global variables when possible.
> I think the main problem is you are defining MemoryPool!(Foo).Chunk which
> specifically needs to know the size of Foo before Foo is completely
> It's like you are doing this:
> struct X
> X x;
> Which clearly is incorrect.
But MemoryPool.sizeof is always 8 (on a 32 bit system) because an alias takes no space. So T.sizeof must be 12. I'd like the compiler to understand this.
Bye and thank you,
More information about the Digitalmars-d-learn