
Dear Boost list Gurus: I got stuck trying to write a binary visitation of a Boost.Variant that modifies one of the arguments, like so: typedef boost::variant<int, float> myVariant; class add : public boost::static_visitor<> { public: void operator()(myVariant& lhs, const myVariant& rhs)const { lhs += rhs; } }; This won't compile with an error indicated that the lhs reference that is not to 'const' cannot be bound to a non-lvalue. I don't understand this error message and the many function template instantiations that are given as reference for the compilation error. Furthermore, I haven't gotten any new ideas how to fix this in the past 2 hours, so I hope to turn to this list for possible solutions. How does one write a binary visitor for Boost.Variants that allow modification of its arguments? Or if that is not possible, how does one, generically, compute with boost::variants? Looking forward to comments that help me understand this, Theo