| | | | | |

FunctorImpl Class Template

template < typename R , class TList > // same parameters as Functor
class FunctorImpl; // polymorphic interface abstracts a function call

template < typename R >
class FunctorImpl<R,NullType>  // specialization 0
{
public:
  virtual R operator()() = 0;
  virtual FunctorImpl * Clone() const = 0;
  virtual ~FunctorImpl(){}
};

template < typename R , typename P1 >
class FunctorImpl<R, TYPELIST_1(P1)>  // specialization 1
{
public:
  virtual R operator()(P1) = 0;
  virtual FunctorImpl * Clone() const = 0;
  virtual ~FunctorImpl(){}
};

template < typename R , typename P1 typename P2 >
class FunctorImpl<R, TYPELIST_2(P1,P2)>  // specialization 2
{
public:
  virtual R operator()(P1,P2) = 0;
  virtual FunctorImpl * Clone() const = 0;
  virtual ~FunctorImpl(){}
};
...

| | Top of Page | 8. Generalized Functors - 5 of 26