Eric Friedman wrote:
Hi,
I can imagine cases where the current behavior might be preferable (e.g., uses of variant types in generic contexts). But I think for the vast majority of cases, and especially in non-generic contexts, checking the type as you propose is a good idea.
I will determine a way to work this into the library, either by modifying the semantics of boost::get or by introducing a new accessor function. Thanks for the input.
Eric Friedman Co-author of Variant library
Great! Thanks a lot. BTW, another two small remarks: The "variant::types" typedef that was used here is not documented, and it will be helpful if I could read about it and about its possible usages. And if you wish not to burden the users with mpl, then it's possible to wrap mpl::contains in a constant boolean value "can_be", as I suggested. But anyway, thanks again.