Template Class UnaryMemberFunction

Inheritance Relationships

Base Type

Class Documentation

template<typename C, typename A, typename R = void>
class UnaryMemberFunction : public ecl::BinaryFunction<C&, A, void>

Binary function object for unary member functions.

Creates a function object from a unary member function.

Usage:

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

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

See also

ecl::utilities::UnaryMemberFunction<C,A,void>, generateFunctionObject, FunctionObjects.

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

  • A – : the member function’s argument type.

  • R – : the return type.

Public Functions

inline UnaryMemberFunction(R (C::* function)(A))

Binary function object constructor for unary member functions.

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

Parameters:

function – : a unary member function.

inline virtual ~UnaryMemberFunction()
inline virtual R operator()(C &class_object, A a)

This ensures any children objects are deleted correctly.

A binary function object call.

Uses the specified class instance and argument to redirect the function call to the unary member function.

Parameters:
  • class_object – : the member function’s class instance.

  • a – : the member function’s argument value.

Returns:

R : the function’s return value.