Template Class PartiallyBoundBinaryMemberFunction

Inheritance Relationships

Base Type

Class Documentation

template<typename C, typename A, typename B, typename R = void>
class PartiallyBoundBinaryMemberFunction : public ecl::BinaryFunction<A, B, void>

Binary function object for partially bound binary member functions.

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

Usage:

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

int main() {
    A a;
    PartiallyBoundBinaryMemberFunction<A,int,string,void> function_object(&A::f,a);
    function_object(1,"dude");
}

See also

FunctionObjects.

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

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

  • B – : the member function’s second argument type.

  • R – : the return type.

Public Functions

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

Binds a binary member function and creates a binary function object.

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

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

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

inline virtual ~PartiallyBoundBinaryMemberFunction()
inline R operator()(A a, B b)

This ensures any children objects are deleted correctly.

A binary function object call.

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

Parameters:
  • a – : the first argument passed to the function (type A).

  • b – : the second argument passed to the function (type B).

Returns:

R : the function’s return value.