Boost logo

Boost Users :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2007-03-19 16:54:18


Christian Henning wrote:
> Hi there, is it possible to have a stateful functor object when using
> fusion::for_each() loop.
>
> I would like to to the following:
>
<snip code>

for_each takes the function object by reference to const, so you have to
const qualify operator() and make the data members mutable so you can
change them anyway.

Note that even if there were overloads for non-const references, the
code as-ia wouldn't work because the function objects in the call to
for_each are rvalues.

Regards,
Tobias


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net