--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
First, boost.variant is move aware, and will try to apply move
semantics when possible. (if your compiler supports rvalue references
or if you use boost.move)
If your class has a nothrow move or nothrow copy, and if you
"document" it as such, boost.variant will only use one unique stack
storage which size and alignment are the maximum possible given the
possible types.
If your move or copy constructors cannot be detected as being nothrow,
it will use an additional temporary heap storage (due to exception-
safety problems in operator=).
As for dispatch, it uses a switch statement, which is highly optimal
too, even more efficient than virtual function calls.