Click here to Skip to main content
15,884,986 members
Articles / Programming Languages / Objective C

Composites and Visitors - a Templatized Approach

Rate me:
Please Sign up or sign in to vote.
4.22/5 (12 votes)
13 Oct 20049 min read 94.8K   457   48  
An article on a templatized implementation of composite and visitor interaction
composite_visitors.cpp
	This contains some test code to demonstrate the templates in action.

GenericTree.h
	This contains the CGenericTree template, used to implement the composite design pattern

GenericVisitor.h
	This contains templates to implement various different visitation strategies.  By mixing
	these strategies into a visitor, you can visit an entire composite tree in a particular
	order

NodeBase.h
	This contains some example classes in a composite hierarchy.  It is used in the test code.

VisitorBase.h
	This contains some sample visitors to demonstrate the use of the generic visitor with the
	Loki library.

Note that to build the application, you must have the Loki library set up in your include paths.

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Web Developer
United Kingdom United Kingdom
I started programming on 8 bit machines as a teenager, writing my first compiled programming language before I was 16. I went on to study Engineering and Computer Science at Oxford University, getting a first and the University Prize for the best results in Computer Science. Since then I have worked in a variety of roles, involving systems management and development management on a wide variety of platforms. Now I manage a software development company producing CAD software for Windows using C++.

My 3 favourite reference books are: Design Patterns, Gamma et al; The C++ Standard Library, Josuttis; and Computer Graphics, Foley et al.

Outside computers, I am also the drummer in a band, The Unbelievers and we have just released our first album. I am a pretty good juggler and close up magician, and in my more insane past, I have cycled from Spain to Eastern Turkey, and cycled across the Namib desert.

Comments and Discussions