
"Richard Peters" <r.a.peters@student.tue.nl> wrote in message news:co291u$68j$1@sea.gmane.org...
I have implemented a different type of visitor for variant: one that does not take the current value held by a variant into account, but a given index. The visitor then calls the visit object with a null pointer of the type of the index-th argument of variant. This is then used by a serializer to extract a value of that type, and assign it to the variant.
Attached are two diff files, one for variant.hpp and one for detail/visitation_impl.hpp, which implement the different visitor and all associated functions, which all have 'param' attached somewhere in their name -- apply_param_visitor, internal_apply_param_visitor_impl, param_visitation_impl_invoke_impl, etc. The serialization is also integrated into variant. I do not know if the authors want this in this place, but it is just a solution that works.
Also attached is an example file to demonstrate that it works.
Oh and I'd like to take the opportunity to thank both the authors of boost.variant and boost.serialization, these libraries will make my life much easier in my current project.
I realize now that I didn't describe what problem I solved. Oops. The code in the previous posting gives a general solution for serializing a variant, so that there is no need to make an ad-hoc serializer for every different variant. best regards, Richard Peters