Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-04-26 02:21:32

Hi Jaakko,

>> struct functor {
>> typedef int result_type;
>> int operator()(int i) const { return i+1; };
>> };
>> transform_iterator<functor, vector<int>::iterator> it(v.begin());
>> (cout << _1)(*it);
>> This does not compile, because operator* of transform_iterator return
>> rvalue
>> which can't be bound to non-const reference that operator() of the
>> lambda
>> expression accepts.

> Forwarding problem again :(

> For a limited number of placeholders (up until _3) or so,
> we could provide the extra overloads to make this problem go away.

Yes, please! I did not ever tried to write BLL expressions with 3
parameters, so I'd really like perfect forwarding limited for 3 arguments.

> N-ary operator() requires 2^N overloads, so for current BLL it is
> feasible, for bind with placeholders up to _9 (or more?) not really.

Right. I think what is needed is *some* solution which would allow to
explore FP, not necessary allow using FP in all situations. Perfect
forwarding for 3 arguments looks fine.

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at