|
|
On 22/04/2012 01:43 PM, Warp wrote:
> Orchid Win7 v1<voi### [at] devnull> wrote:
>> 1. You can take a 5-argument function, pass it 2 argument, and get a
>> 3-argument function as the result.
>
> Would this be currying in C++?
>
> std::function<int(int)> multiplierFunction(int multiplier)
> {
> return [multiplier](int value) { return value * multiplier; };
> }
>
> The above function returns a function that takes an integral as parameter
> and returns it multiplied by the specified multiplier.
Yeah, I think that would satisfy my idea of "curried function".
The question is, does
multiplierFunction(3)(4)
or similar yield a 12?
Post a reply to this message
|
|