higher-order functions
Steven Schveighoffer
schveiguy at yahoo.com
Tue Nov 2 05:59:31 PDT 2010
On Sun, 31 Oct 2010 19:20:04 -0400, bearophile <bearophileHUGS at lycos.com>
wrote:
> Simen kjaeraas:
>
>> They take both, in fact:
>>
>> auto cubes = map!((a){ return a*a*a; })(arr);
>
> But that needs to be compile-time constant, so if you have several
> functions, you need to put them inside a typetuple, or duplicate the
> code. And some idioms are just not possible.
I don't think it needs to be a compile-time constant.
I think one of the most horrible problems with documenting D templates is
it's impossible to tell what's possible without trying it.
-Steve
More information about the Digitalmars-d-learn
mailing list