Visitor In Frameworks

An article in CppReport that discusses how to achieve extensible double dispatch with nearly full static typechecking a la the VisitorPattern. A draft lives at http://www.research.ibm.com/designpatterns/pubs/ph-nov-dec99.pdf.

See also TooledComposite.

--JohnVlissides


I have also used the visitor pattern in an application framework. An edited version of something I wrote in my programmer's notebook is at http://www.determan.net/articles/doubledispatcharticle.pdf. Please keep in mind that this design has never been reviewed by anyone. While I claim my implementation is easy to use, it can be tricky to implement. There are other designs that are much easier to implement than mine (with other tradeoffs). If there is interest, I will post the code to the web under an appropriate license (lgpl?). I've used this code in a couple projects and it works well. It handles inheritance correctly, has constant-time overhead, and can be used in a framework (no dependency between "node" and "visitor" classes).

-ScottDe (I'm a better programmer than a writer. Be gentle...)


[CategoryFramework]


EditText of this page (last edited November 19, 2011) or FindPage with title or text search