Template Class BoundUnaryFreeFunction

Inheritance Relationships

Base Type

Class Documentation

template<typename A, typename R = void>
class BoundUnaryFreeFunction : public ecl::NullaryFunction<void>

Nullary function object for bound unary global/static functions.

Binds the argument to a unary global/static function and uses this to construct a nullary function object.

Usage:

void f(int i) {}

int main() {
    BoundUnaryFreeFunction<int,void> function_object(f,1);
    function_object();
}

Note, often the use of generateFunctionObject is simpler.

See also

ecl::utilities::BoundUnaryFreeFunction<A,void>, generateFunctionObject, FunctionObjects.

Template Parameters:
  • A – : the type of the argument to be bound.

  • R – : the return type.

Public Functions

inline BoundUnaryFreeFunction(R (*function)(A), A a)

Binds a unary function and creates a nullary function object.

Accepts both the function and a value for its single argument, binds them and creates a nullary function object.

Parameters:
  • function – : the unary global/static function.

  • a – : the argument to bind.

inline virtual ~BoundUnaryFreeFunction()
inline virtual R operator()()

This ensures any children objects are deleted correctly.

A nullary function object call.

Redirects the function object call to the bound global/static function.

Returns:

R : the function’s return value.