[fusion] mutable action

27 Nov
2011
27 Nov
'11
11:55 p.m.
Hi, How can I apply mutable action to the fusion sequence? It seems like fusion::for_each does not allow non const operator(). Gennadiy

28 Nov
28 Nov
7:11 a.m.
On 11/28/2011 7:55 AM, Gennadiy Rozental wrote:
Hi,
How can I apply mutable action to the fusion sequence?
It seems like fusion::for_each does not allow non const operator().
Function objects are passed around by value. It does not make sense for them to be mutable. Better yet, give it a reference to some mutable state, like: struct f { f(T& state) : state(state) {} T& state; void operator()() const {} }; Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
4835
Age (days ago)
4836
Last active (days ago)
1 comments
2 participants
participants (2)
-
Gennadiy Rozental
-
Joel de Guzman