Boost logo

Boost :

Subject: Re: [boost] painless currying
From: David A. Greene (greened_at_[hidden])
Date: 2011-08-24 12:42:31


Eric Niebler <eric_at_[hidden]> writes:

> On a lark, I implemented a wrapper that turns any TR1-style function
> object into a "curryable" function object (attached). Successive
> function call invocations bind arguments until enough arguments are
> bound to invoke the wrapped function. With it you can do the following:
>
> curryable<std::plus<int> > p;
> auto curried = p(1);
> int i = curried(2);
> assert(i == 3);
>
> Is there any interest in such a thing?

Most definitely!

                        -Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk