mrdocs::Visitor

A visitor for a type

Synopsis

Declared in <mrdocs/Support/Visitor.hpp>

template<
    typename Base,
    typename Fn,
    typename... Args>
class Visitor;

Description

This class is used to implement the visitor pattern. It stores a reference to an object of type Base, and a function object Fn which is called with the derived type as the first argument, followed by Args.

The visitor is constructed with the object to visit, the function object, and the arguments to pass to the function object.

The method visit is a template which accepts a derived type of Base. It calls the function object with the derived type as the first argument, followed by the arguments passed to the constructor.

Member Functions

Name

Description

Visitor [constructor]

Constructor

visit

Visit a derived type

Template Parameters

Name Description

Base

The base type of the object

Fn

The function object type

Args

The argument types

Created with MrDocs