On Tue, Dec 10, 2013 at 1:35 PM, Larry Evans
I'm trying to understand how you arrive at the static_visitor. Since the set of bounded types in the variant is a result of metaprogramming, I'm guessing that the static_visitor would also have to be the result of some metaprogramming. Otherwise I can't figure out how it could be done.
The visitor is not metaprogrammed. The "display" visitor is used for generic visualization of the variant, regardless of what's inside. It simply has an operator() template that uses a display function found by ADL (much like operator<< would be if we were doing generic output to a stream). If the variant is just variant<>, it makes sense to not display anything in this particular case. This would all be trivial to do if variant<> just worked and we specified what happens when you use apply_visitor on it.
I'm guessing that you use some sort of inheritance for each bounded type. Is that right?
No. -- -Matt Calabrese