Boost logo

Boost :

From: Jesse Jones (jesjones_at_[hidden])
Date: 2001-05-04 07:58:29


At 3:28 PM +0300 5/4/01, Peter Dimov wrote:
>From: "Jesse Jones" <jesjones_at_[hidden]>
>
>> Hmm, I think I could live with that. It's important to make this as
>> easy to use and as clean as possible though because it'll be used a
>> lot. I looked at the bind.hpp that Peter pointed me to and it had a
>> different (and to my eyes uglier) API.
>
>Hm. bind.hpp that I posted to the list works like this:
>
>bind(&CApp::DoAbout, this);
>
>which only differs by the version you want in the argument order. The
>function object comes first for consistency (a member pointer is considered
>a function object with an implicit 'this' as a first argument.)
>
>What's uglier in this API?

Nothing.

>The other bind usage is
>
>bind(&CWidget::DoRedraw)
>
>used in situations like this:
>
>// vector<CWidget> w;
>// vector<CWidget*> w;
>
>vector<shared_ptr<CWidget> > w;
>
>for_each(w.begin(), w.end(), bind(&CWidget::DoRedraw));

I didn't read your earlier email carefully enough. All the examples
were of the second form:
  bind(&X::f)(x);
and I didn't realize you were actually calling the method. It seems
obvious in retrospect. :-)

   -- Jesse


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk