Feel++ 0.91.0

Feel::Visitor< T, R > Class Template Reference

#include <visitor.hpp>

List of all members.

Public Types

Typedefs
typedef R return_type

Public Member Functions

Constructors, Destructors and methods
virtual ~Visitor ()
 virtual base destructor
virtual return_type visit (T *)=0
 visit a data structure
return_type visit (T &__t)
 visit a data structure

Detailed Description

template<class T, typename R = void>
class Feel::Visitor< T, R >

This class is the base class to implement the Visitor Pattern. Let's A be a visitor class to a class B:

  class A: public Visitor<B>
  {
  public:
  ...
  void visit(B * b)
  {
  ..implement the functionnality to be added to a B class..
  }
  };
  class B:
  {
  public:
  void accept(Visitor<B>* b){  b->visit(this); }
  };
Author:
Christophe Prud'homme <Christophe.Prudhomme@ann.jussieu.fr>
See also:
Gamma, Helm, Johnson, Vlissides, Design Patterns Pub: Addison Wesley