Template Class NullaryMemberFunction

Inheritance Relationships

Base Type

Class Documentation

template<typename C, typename R = void>
class NullaryMemberFunction : public ecl::UnaryFunction<C&, void>

Unary function object for member functions without arguments.

Creates a function object from a member function without arguments (note, the single argument to this unary function object is the class instance itself).

Usage:

class A {
public:
    void f() { //...
    }
};

int main() {
    A a;
    NullaryMemberFunction<A,void> function_object(&A::f);
    function_object(a);
}

See also

ecl::utilities::NullaryMemberFunction<C,void>, generateFunctionObject, FunctionObjects.

Template Parameters:
  • C – : the member function’s class type type.

  • R – : the return type.

Public Functions

inline NullaryMemberFunction(R (C::* function)())

Unary function object constructor for member functions without arguments.

Accepts a void member function, and builds the function object around it.

Parameters:

function – : a void member function.

inline virtual ~NullaryMemberFunction()
inline virtual R operator()(C &class_object)

This ensures any children objects are deleted correctly.

A unary function object call.

Uses the specified class instance to redirect the function call to the void member function.

Parameters:

class_object – : the member function’s class instance.

Returns:

R : the function’s return value.