This is an update to the previous post about templating the Visitor pattern.
Templated implementation of the Visitor Pattern for C++03
I won’t repeat the bulk of the post as the examples will be identical.
The new code uses ‘variadic temples’ that were introduced with C++11, and as such, greatly simplifies the code required.
There, that’s it! It is able to handle any number of visitor types and doesn’t require N specialisations of the template.
The change to Visitor is just as radical.