challenge #2: implement the vararg_reduce metafunction
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Tue Jan 23 00:44:46 PST 2007
My previous post defines max by availing itself of a metafunction called
vararg_reduce. Your challenge is to define it. vararg_reduce takes an
alias which it assumes is a function of two arguments, and it defines a
vararg function that applies that alias repeatedly, similarly to the
reduce primitive that is present in functional languages. Again, for
background on functional reduce, see e.g.:
http://www.joelonsoftware.com/items/2006/08/01.html
Define vararg_reduce to deduce the result type properly, and to generate
code as efficient as possible.
Andrei
More information about the Digitalmars-d
mailing list