Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-08-13 08:50:54


From: "Albrecht Fritzsche" <albrecht.fritzsche_at_[hidden]>
>
> And that object pointer passing was missing in my code and
> was achieved in your code through the binding? I had already
> looked at boost::bind but still cannot figure out its interface
>
> template<class F, class A1> unspecified-3-1 bind(F f, A1 a1);
>
> What is this returning?

Following the boost::bind reference is not an easy task. :-) First, you need

template<class R, class T, class A1> unspecified-5 bind(R (T::*f) (), A1 a1)
Effects: equivalent to bind<R>(boost::mem_fn(f), a1);

since the first argument is a member function. This redirects you to

template<class R, class F, class A1> unspecified-3 bind(F f, A1 a1)
Returns: a function object λ such that the expression λ(v1, v2, ..., vm) is
equivalent to f(µ(a1, v1, v2, ..., vm)), implicitly converted to R.

Throws: Nothing unless the copy constructors of F or A1 throw an exception.

and all this translated to English means that

boost::bind(&Manager::Check, this)

returns a function object that, when called, returns

boost::mem_fn(&Manager::Check)(this)

that, in turn (see the mem_fn documentation) is equivalent to

(this->*&Manager::Check)();

The thing to remember is that member functions have an additional implicit
argument, the object pointer/reference.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net