Why can't templatized classes be aliased ?

Daniel Murphy yebblies at nospamgmail.com
Fri May 10 11:31:08 PDT 2013


"KeyboardRider" <KeyboardRider at nowhere.com> wrote in message 
news:vabffcdkuarjzbsivkmc at forum.dlang.org...
> with these simple types:
>
> class Implementator1(T){}
> class Implementator2(T){}
> class Implementator3(T){}
>
> version(1)
> {
>   class ChosenImplementator(T): Implementator1!T{}
> }
>
> version(2)
> {
>   class ChosenImplementator(T): Implementator3!T{}
> }
>
> version(All)
> {
>   class Foo(T)
>   {
>      ChosenImplementator!T Bar;
>   }
> }
>
> Why isn't it possible, technically, to alias a template ?
> (such like that:)
>
> version(1)
> {
>   alias (Implementator1(T)) ChosenImplementator(T);
> }
>
> version(2)
> {
>   alias (Implementator2(T)) ChosenImplementator(T);
> }
>
> which would avoid to polute a templatized class with some compiler 
> switches.
> Would aliasing template make sense ?

Or even

template ChosenImplementator(T) { alias ChosenImplementator = 
Implementator1!T; } 




More information about the Digitalmars-d mailing list