contents next up previous
Next: Sampler Up: Concepts Definitions Previous: Non-Parametric Cdf

Function Objects

A function object, or functor, is an object that can be called using an ordinary function call. It can be a pointer to a function or an object with a member function operator(). For example, object sine is a function object: struct sine{
  double operator(double x) {return sin(x);}
};

because if my_sine is of type sine, my_sine can be called by: my_sine(x) and return sin(x), just as if my_sine was a function.



Subsections

nicolas
2002-05-07