It works pretty much the way you described. Long story short:
It has an integer
which
that indicates which data type is used.The storage is implemented using boost's
aligned_storage
which basically is a buffer of the maximum data size. (it is in a union, but for alignment purposes)
Finally, the visitor is indeed implemented with a switch
, generated at compile time using macros to unroll for all type possibilities.