Template Class PartiallyBoundUnaryMemberFunction

Inheritance Relationships

Base Type

Class Documentation

template<typename C, typename A, typename R = void>
class PartiallyBoundUnaryMemberFunction : public ecl::UnaryFunction<A, void>

Unary function object for partially bound unary member functions.

Binds the class instance but not the argument for a unary member function and uses this to construct a unary function object.

Usage:

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

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

See also

FunctionObjects.

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

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

  • R – : the return type.

Public Functions

inline PartiallyBoundUnaryMemberFunction(R (C::* function)(A), C &class_object)

Binds a unary member function and creates a nullary function object.

Accepts the function, class instance only (not the argument), binds them and creates a unary function object.

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

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

inline virtual ~PartiallyBoundUnaryMemberFunction()
inline virtual R operator()(A a)

This ensures any children objects are deleted correctly.

A unary function object call.

Redirects the unary function object call to the bound member function.

Parameters:

a – : the argument passed to the function.

Returns:

R : the function’s return value.