template<class T, typename R = void, bool ConstVisit = false>
class Loki::Visitor< T, R, ConstVisit >
The building block of Acyclic Visitor
- Usage
Defining the visitable class:
* class RasterBitmap : public BaseVisitable<>
* {
* public:
* };
*
Way 1 to define a visitor:
* class SomeVisitor :
* public BaseVisitor
* public Visitor<RasterBitmap>,
* public Visitor<Paragraph>
* {
* public:
* void Visit(RasterBitmap&);
* void Visit(Paragraph &);
* };
*
Way 2 to define the visitor:
* class SomeVisitor :
* public BaseVisitor
* public Visitor<LOKI_TYPELIST_2(RasterBitmap, Paragraph)>
* {
* public:
* void Visit(RasterBitmap&);
* void Visit(Paragraph &);
* };
*
Way 3 to define the visitor:
* class SomeVisitor :
* public BaseVisitor
* public Visitor<Seq<RasterBitmap, Paragraph>::Type>
* {
* public:
* void Visit(RasterBitmap&);
* void Visit(Paragraph &);
* };
*
- Using const visit functions:
Defining the visitable class (true for const):
* class RasterBitmap : public BaseVisitable<void, DefaultCatchAll, true>
* {
* public:
* };
*
Defining the visitor which only calls const member functions:
* class SomeVisitor :
* public BaseVisitor
* public Visitor<RasterBitmap, void, true>,
* {
* public:
* void Visit(const RasterBitmap&);
* };
*
- Example:
test/Visitor/main.cpp