From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-08-10 17:55:00
Giovanni Piero Deretta wrote:
>> Also note that Boost.Lambda can't be used here.
>> A Boost.Lambda functor is not Assignable.
> Yes, that is very unfortunate and I think it should be fixed.
> I saw that oven uses a special wrapper to make boost.lambda objects
> copiable. What does it exactly do?
As you guess, the wrapper uses Boost.Optional.
It's rather simple: http://tinyurl.com/2nvw59
> The wrapper I use simply does a placement new in its assignment operator.
> This is very exception unsafe, but I presume that most (all?) lambda
> objects won't throw
> on copy constructor. Using boost.optional would give the basic
> exception safetly, but it does increase the size of the wrapper.
I'm not sure.
Boost.Optional also seems to use placement-new.
Anyway, Boost.Optional seems fundamental,
because Boost.Lambda functors are not DefaultConstructible,
which ForwardIterator requires.
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk