Boost logo

Boost :

Subject: Re: [boost] [range] treating N-ary function with N-1 default args as unary
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-06-30 19:18:31


Le 30/06/12 18:47, Steven Watanabe a écrit :
> AMDG
>
> On 06/30/2012 09:24 AM, Vicente J. Botet Escriba wrote:
>> Le 30/06/12 06:07, Nathan Ridge a écrit :
>>> int foo(int a, int b = 0);
>>>
>>
>> I agree that it will be interesting to have a way to make this bar
>> transformation using a class template unary
>>
>> int main()
>> {
>> int A[5];
>> A | boost::adaptors::transformed(unary<foo>());
>> }
>>
> Not possible. There's no way to preserve
> default arguments when taking a pointer
> to a function.
>
>
Yes I know.

Could a lambda help on this context?

int main()
{
     int A[5];
     A | boost::adaptors::transformed([](int a){ return foo(a);});
}

Vicente


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