"KennyTM~" <kenn...@gmail.com> wrote in message news:im0gtr$1o3q$1...@digitalmars.com... > On Mar 19, 11 04:41, Steven Schveighoffer wrote: >> On Fri, 18 Mar 2011 16:37:49 -0400, Andrei Alexandrescu >> <seewebsiteforem...@erdani.org> wrote: >> >>> On 3/18/11 3:28 PM, so wrote: >>>> alias a(T) = b(T, known_type); >>>> >>>> Would it be an overkill? >>> >>> It's part of the evil plan. >> >> (I think there is a typo above, shouldn't it be alias a(T) = b!(T, >> known_type) ? ) >> >> You mean you would no longer need the surrounding template declaration? >> >> i.e. the above (corrected) statement would be short for: >> >> template a(T) >> { >> alias a = b!(T, known_type); >> } >> >> That would be certainly very un-evil ;) >> >> -Steve > > Being evil would be: > > alias staticReduce(alias F, alias Init) = Init; > alias staticReduce(alias F, alias Init, T...) if (T.length != 0) = > staticReduce!(F, F!(Init, T[0]), T[1..$]); > // ^ support conditionals? > enum addSize(int total, T) = total + T.sizeof; > // ^ yeah why not generalize to enum too? > > static assert(staticReduce!(addSize, 0, byte, short, int, long[2], float, > double) == 35); > > > ;)
Tasty. I like it.