A C++ template library for embedded applications
MIT licensed
Designed and
maintained by
John Wellbelove

Visitor

A set of template classes to enable the easy creation of objects using the Visitor pattern.
The purpose of these classes is to create a base classes with pure virtual functions for each supplied type.
Any derived class that tries to instantiate an object from it will then be forced to supply an overridden version for each
and every function. See the tutorial.

There are two templated classes:-

____________________________________________________________________________________________________

visitable

The visitable base class.

Classes derived from this are visitable by the types declared in the template parameter list. A pure virtual accept
function will be created for each visitor type.

C++03

Up to four visitor types may be specified.

template <typename T1, typename T2 = void, typename T3 = void, typename T4 = void>
class visitable

____________________________________________________________________________________________________

C++11 and above

Any number of visitor types may be specified.

template <typename... Args>
class visitable;

____________________________________________________________________________________________________

visitor

The visitor base class.
Classes derived from this can be passed to objects derived from visitable.
A pure virtual visit function will be created for each specified type.

C++03

Up to sixteen types may be specified in the template parameter list

template <typename T1,         typename T2  = void, typename T3  = void, typename T4  = void,
          typename T5  = void, typename T6  = void, typename T7  = void, typename T8  = void,
          typename T9  = void, typename T10 = void, typename T11 = void, typename T12 = void,
          typename T13 = void, typename T14 = void, typename T15 = void, typename T16 = void>
class visitor

____________________________________________________________________________________________________

C++11 and above

Any number of types may be specified.


template <typename… Types>
class visitor
visitor.h