template class Binder1<typename R, typename A1>

Binds values to the parameters of a function.

A binder is a special kind of adapter that calls a function via a pointer with a predefined - and therefore constant - value for each of its parameters. There exist binders for functions with 1 to 4 arguments, Binder1 to Binder4

A convenience function is provided for each binder (bind). Using this function removes the burden of manually specifying the function and the argument type when instantiating one of the binder template. Scrunitizer has binders for functions from 1 to 4 parameters (type A1- A4) that could return an arbitrary type (type R). The return value is always ignored.

template<typename R, typename A1> 
      inline Binder1<R,A1> bind (R (*func)(A1), A1 arg);

template<typename R, typename A1, typename A2> 
      inline Binder2<R,A1,A2> bind (R (*func)(A1,A2), A1 arg1, A2 arg2);

template<typename R, typename A1, typename A2, typename A3> 
      inline Binder3<R,A1,A2,A3> bind (R (*func)(A1,A2,A3), A1 arg1, A2 arg2, A3 arg3);

template<typename R, typename A1, typename A2, typename A3, typename A4> 
      inline Binder4<R,A1,A2,A3,A4> bind (R (*func)(A1,A2,A3,A4), A1 arg1, A2 arg2, A3 arg3, A4 arg4);
 




Public Members:
    Binder1 (func_type func, A1 arg1) ;
    Create a binder (for a function with one parameter).
    Beside the function pointer, an argument is needed for the first parameter. A1 is the type of the functions single parameter.

    Binder1 (const Binder1& tmpl) ;
    Copy constructor.
    Creates a copy of the binder (same function, same parameter value).

    void operator() () ;
    The function call operator.
    It invokes the given function with the specified argument value.




The Scrunitizer C++ Unit Test Framework
by Bernd Linowski

[Scrunitizer]  [Overview]  [Cookbook]  [Download]  [Index]  [Linosphere]

Page generated: 1 Nov 2000
(C) by Bernd Linowski
scrunitizer@linosphere.de