[Question] About mixin, template and alias

Michael pr at m1xa.com
Sun Sep 22 14:18:12 PDT 2013


> This:
> //----
>     auto eventObserver =  new Event!DelegateType();
> //----
> Does not do what you think it does: It *statically* initializes 
> "eventObserver" to the *single* "new Event!DelegateType();". SO 
> basically, all your instances are sharing the same Event.
>
> I'm surprised this compiles at all, what with Fire.init 
> depending on a run-time call, but apparently, dmd is "smart 
> enough" to do the allocation at compile time.

Why like "static"?



More information about the Digitalmars-d-learn mailing list