Template Class BoundUnaryMemberFunction

Inheritance Relationships

Base Type

Class Documentation

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

Nullary function object for bound unary member functions.

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

Usage:

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

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

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 BoundUnaryMemberFunction(R (C::* function)(A), C &class_object, A a)

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

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

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

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

  • a – : the value of the argument to bind.

inline virtual ~BoundUnaryMemberFunction()
inline virtual R operator()()

This ensures any children objects are deleted correctly.

A nullary function object call.

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

Returns:

R : the function’s return value.