CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
Visitor< Tag, Visitables > Class Template Reference

#include <visitor.h>

Public Types

using visitable_types = std::tuple< Visitables... >
 

Public Member Functions

template<class T >
auto operator() (T &t) -> std::enable_if_t< is_within< T, visitable_types >::value, void >
 
template<class... Fs>
 Visitor (Fs &&... fs)
 

Detailed Description

template<class Tag, class... Visitables>
class Visitor< Tag, Visitables >

Visitor type generator for types included in visitable_types. Produces type-safe instance of Visitor per given Tag and a type-list of Visitables (at least one). User shall derive publicly from this type Visitor<Tag, Vs...> (tag can be the name of the derived type), and inherit Visitor constructor. Visitable types must be derived from VisitableWith<T> where T is the name of the visitor. Do not pass references in Visitables type-list.

Example

struct Example
Example // tag
, A, B, C, D // visitable types
>
{
};
Definition visitor.h:41
Visitor(Fs &&... fs)
Definition visitor.h:147
See also
CanNodeDataModelVisitor for an example
http://insooth.github.io/visitor-pattern.md for an article

Member Typedef Documentation

◆ visitable_types

template<class Tag , class... Visitables>
using Visitor< Tag, Visitables >::visitable_types = std::tuple<Visitables...>

Constructor & Destructor Documentation

◆ Visitor()

template<class Tag , class... Visitables>
template<class... Fs>
Visitor< Tag, Visitables >::Visitor ( Fs &&...  fs)
inline

Member Function Documentation

◆ operator()()

template<class Tag , class... Visitables>
template<class T >
auto Visitor< Tag, Visitables >::operator() ( T &  t) -> std::enable_if_t<is_within<T, visitable_types>::value, void>
inline

else: noop – action not specified


The documentation for this class was generated from the following file: