19 Mar
2007
19 Mar
'07
9:56 p.m.
Tobias Schwinger wrote:
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.
IMO, this is a bug in Fusion. There should be an overload of for_each that takes a function object by non-const reference. Stateful predicates should be supported, and Fusion should be explicit about where and when predicates are copied, so that the state doesn't get messed up. -- Eric Niebler Boost Consulting www.boost-consulting.com