Boost logo

Boost :

From: Greg Dehaas (GregDehaas_at_[hidden])
Date: 2003-02-10 02:23:46


Is there a way of using ptr_fun on a method (class instance's function) ?
It can come in very useful

-----Original Message-----
From: Amélie et François Dumont [mailto:francois.amelie_at_[hidden]]
Sent: Saturday, February 08, 2003 5:01 PM
To: boost_at_[hidden]
Cc: cdm.henderson_at_[hidden]; GregDehass_at_[hidden]
Subject: RE: [boost] Re: binding

Just a little remark about the code that has nothing to do with the bug that
has been elucidated by Graig Henderson. When Greg Dehaas wrote:

> I have a namespace GenAlg with this inside:
> --------------------------------------------------------------------
> namespace GenAlg
> {
> template <class TController, class TFitness>
> unsigned long RouletteWheel(TController *oController)
> {
> ...
> }
> }
> --------------------------------------------------------------------
>
> elsewhere I have a
> --------------------------------------------------------------------
> boost::function1<unsigned long, CGAController *> fncSelection;
> --------------------------------------------------------------------
>
> I try to set fncSelection to RouletteWheel like so:
> --------------------------------------------------------------------
> fncSelection = boost::bind(GenAlg::RouletteWheel<CGAController, unsigned
> long>,_1);
> --------------------------------------------------------------------
>

It seems to me that it would have been more accurate to write:

fncSelection = boost::ptr_fun(GenAlg::RouletteWheel<CGAController, unsigned
long>);

there is no use for the boost::bind function even if the result is finally
the same ;-)

_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


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