These are very interesting and useful, thank you. I now have hard evidence with which to persuade people at work that Boost.Variant needs to be purged from our latency critical paths.
Niall if you don't mind, we'd like to know what the largest number of types you have in a variant in that code base is.
Somewhere between five and twenty I think, depending on use case. They're scattered all over. For me the main problem is the hidden dynamic memory allocation which is happening every state change inside a critical path. But we don't have C++ 17 available, hence my great interest in variant2. (We actually use a completely renamed fork of Boost, so all macros, headers and namespaces are renamed with a custom prefix to prevent collision with customer Boosts. This takes many hours to regenerate, so we lag latest Boost considerably. Still, if there's a suitably pressing need, it'll get regenerated in order to get Mp11 in order to get variant2) Niall