
I have 2 fusion containers: a small vector (my_vec) and a bigger set (my_set). I want to overwrite the elements of the set with elements from the vector whenever they have the same type. Sounds simple:
struct update { update(my_set_type& to_overwrite_):to_overwrite(to_overwrite_){} template<typename T> void operator()(T& elt) /*const?*/ { boost::fusion::at_key<T>(to_overwrite)=elt; } my_set_type& to_overwrite; };
boost::fusion::for_each(my_vec,update(my_set));
Except that this won't compile because the operator() is required to be const, which is sad, because it was very simple.
And it won't compile *with* the const? I don't think the const'ness of the member function affects the const'ness of the referent of to_overwrite.
No, it won't compile ;-)