Forward references and more
bearophile
bearophileHUGS at lycos.com
Mon Oct 12 12:38:07 PDT 2009
Steven Schveighoffer:
> 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
> declared.
> 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,
bearophile
More information about the Digitalmars-d-learn
mailing list