Starting a new project with boost::variant, I got into thinking about a general generic visitor for boost::variant...
boost::variant and a general, generic visitor class
by Jens Weller
From the article:
So, I started a new project, and I do use boost::variant to be able to stick otherwise unrelated classes into the same container. Actually a tree, but that doesn't matter here. With boost::variant, you simply derive your visitor class from the static_visitor class, which lets you visit the types in a boost::variant via the call operator. When you want to do always the same for all types, you simply can add a template method version of the call operator...
Add a Comment
Comments are closed.