Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-05-04 07:28:24


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?

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));

[A generalization of mem_fun/mem_fun_ref]

--
Peter Dimov
Multi Media Ltd.

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