Description

Include the STL standard header <functional> to define several templates that help construct function objects, objects of a type that defines operator(). A function object can thus be a function pointer, but in the more general case the object can store additional information that can be used during a function call.

Note: Additional functionality has been added to this header for TR1. To enable this functionality, you must define the macro __IBMCPP_TR1__ .

The following terminology applies to features added with TR1:

A call signature is the name of a return type followed by a parenthesized comma-separated list of zero or more argument types.

A call wrapper is an object of a call wrapper type.

A call wrapper type is a type that holds a callable object and supports a call operation that forwards to that object.

A callable object is an object of a callable type.

A callable type is a pointer to function, a pointer to member function, a pointer to member data, or a class type whose objects can appear immediately to the left of a function call operator.

A target object is the callable object held by a call wrapper object.

The pseudo-function INVOKE(f, t1, t2, ..., tN) means:

The pseudo-function INVOKE(f, t1, t2, ..., tN, R) means INVOKE(f, t1, t2, ..., tN) implicitly converted to R.

If a call wrapper has a weak result type the type of its member type result_type is based on the type T of the wrapper's target object:

Every call wrapper has a copy constructor. A simple call wrapper is a call wrapper that has an assignment operator and whose copy constructor and assignment operator do not throw exceptions. A forwarding call wrapper is a call wrapper that can be called with an argument list t1, t2, ..., tN where each ti is an lvalue.

The call wrappers defined in this header support function call operators with arguments of types T1, T2, ..., TN, where 0 <= N <= NMAX. In this implementation the value of NMAX is 10. By default, the compiler generates code that enables function call operators with up to 3 arguments, thus, N = 3. When more arguments is required, _NARGS_CONST macro can be defined to value greater than 3. However, its value has to be within [0, 10]. This macro has to be used carefully because the compile time increases exponentially.