typedef behavior

Alex sascha.orlov at gmail.com
Sat Feb 10 02:08:50 UTC 2018


On Saturday, 10 February 2018 at 01:23:20 UTC, Ali Çehreli wrote:
> >
> > Yup. They are shared by two Typedef instantiations with
> different cookies.
> >
> > So...
> > The question is two-fold:
> > Would it help to alter the init value of the Typedef?
> > If yes, how to alter it?
> > If no, is this a bug?
>
> I think this is a limitation of Typedef.
>
> I can't see a way out (at least one that can support any type 
> E). It should be possible if you can modify E but I can't work 
> something out now.
>
> Ali

Ah... From your hint I arrived at the following:

Inside of the struct E I define more then one static array. 
Namely, one for each Typedef I plan to instantiate. The Typedefs 
have to be known at compile time, so the amount of them has to be 
known by me :)
Then, during the initialization, I work only with one of the 
arrays of E, depending on the Typedef I use.
During the work inside of E, the object will have to check, which 
array was initialized and cooperate with this array, as this is 
the only possibility.

As a workaround this will work, I think... Thanks!

Nevertheless, I would file a bug later on... all ideas are 
appreciated in the meanwhile.


More information about the Digitalmars-d-learn mailing list