On Tue, 30 Nov 2010 18:49:56 +0300, Dmitry Olshansky wrote:
> On 30.11.2010 14:59, Lars T. Kyllingstad wrote:
>> In my library I have a lot of functionals (functions that take other
>> functions as parameters). Here is an example that shows the style I
>> use to define them:
>>
>> // Example
Lars T. Kyllingstad Wrote:
> // Same as above, using template alias parameter.
> auto eval(alias f, X)(X x) { return f(x); }
>
> // Test
> void main()
> {
> int add2(int i) { return i + 2; }
> assert (eval!add2(1) == 3);
> }
>
> I'd be grateful if people w
On 30.11.2010 14:59, Lars T. Kyllingstad wrote:
In my library I have a lot of functionals (functions that take other
functions as parameters). Here is an example that shows the style I use
to define them:
// Example: Evaluate the function/delegate/functor f at x.
auto eval(F, X)(F f,
In my library I have a lot of functionals (functions that take other
functions as parameters). Here is an example that shows the style I use
to define them:
// Example: Evaluate the function/delegate/functor f at x.
auto eval(F, X)(F f, X x) { return f(x); }
// Test
void main()