Implementation Challenge: Revisiting the visitor pattern
C++ as a language is moving away from the classical, “Java style”, object-oriented programming.
Long gone are the days of grand, virtual
hierarchies.
They’ve been replaced with standalone classes, free functions and type erasure.
And the benefits are clear: Instead of reference semantics, they allow value semantics which are simpler and more natural for C++. Instead of intrusive interface inheritance, they allow external duck-typing.
So in the spirit of this movement, let’s take a look at one OOP pattern and see if we can adopt it to this style: the visitor pattern.
» read more »