| | | | | |

Functor Class Template - 4

template < typename R , class TList >
class Functor
{
... as before ...
public:
  R operator()()
  {
    return (*spImpl_)();
  }
  R operator()(Parm1 p1)
  {
    return (*spImpl_)(p1);
  }
  R operator()(Parm1 p1, Parm2 p2)
  {
    return (*spImpl_)(p1, p2);
  }
  ...
};
  • Compiler instantiates member functions for templates only if they are used

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