catchy phrase for this idiom?
BCS
ao at pathlink.com
Thu Mar 12 13:56:55 PDT 2009
Reply to Denis,
> Back on topic, I don't see anything wrong with this code. It defines
> exactly one alias.
>
> I also think that it should define exactly one /public/ alias:
>
> template Blah(T)
> {
> private alias Foo!(T).A Tmp1;
> private alias Bar!(Tmp1!(T)).B Tmp2;
> static if (Tmp2.C!(T)) {
> private alias Tmp2.ResultA Tmp3;
> } else {
> private alias Tmp2.ResultB Tmp3;
> }
> /*public*/ alias Tmp3!(Tmp2!(Tmp1!())).C Blah; }
>
That covers my one major concern with the exactly one rule; local values.
OTOH I have used template with many public value as a type of compile time
structs. It's an absolute must for anything thing that require data structures
like parsing of strings.
More information about the Digitalmars-d
mailing list