compile time sequence variable

Andrey andrey at kabylin.ru
Sat Sep 30 19:13:25 UTC 2017


Hello, can I make AliasSeq not inside template function, for 
example I want add function called `registerComponent` which will 
add the components classes to list and based on this generated 
list I want add additional fields inside `ComponentsManager`. 
Example:
Registering components:
> struct MyComponent {
>     float avg;
>     string name;
> }
>
> struct MyComponent2 {
>     string name;
>     string text;
>     string title;
> }
>
> static {
>     registerComponent!(MyComponent);
>     registerComponent!(MyComponent2);
> }

And my `ComponentsManager`:
> class ComponentsManager {
>     // Automatically generated fields
>     Array!MyComponent myComponentList;
>     Array!MyComponent2 myComponent2List;
>
>     // Other fields and methods
> }

How can I do this? furthermore I would like using 
`registerComponent` from different modules.


More information about the Digitalmars-d-learn mailing list