Boost logo

Boost :

From: sgregory_at_[hidden]
Date: 2001-11-13 13:35:23


--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> From: <sgregory_at_c...>
> > Hello again
> >
> > // pseudo-snippit
> > class Axis {
> > bool AddTick(const double); // bool added for MS so as not to
> > return void
> > };
> >
> > Axis a;
> > std::list<double> l;
> >
> > std::for_each(l.begin(), l.end(),
> > boost::bind( &Raxis::AddTick, &a ) );
> >
> > So... MS complains
> > 'bind' : none of the 2 overloads can convert parameter 1 from
> > type 'bool (__thiscall Raxis::*)(const double)'
> >
> > Huh? Help?
>
> Oops. My bad. Should be
>
> boost::bind( &Axis::AddTick, &a, _1 ) // or &Raxis::AddTick?
>
> since &Axis::AddTick takes two arguments, 'Axis * this' and 'const
double'.

Actually - I mistyped the example - I did have _2 as the third
parameter to bind. But neither _1 nor _2 work. Same error both
ways... (And in my real code it is Raxis. Example was typed, error
was cut/paste)

Is is ok that AddTick takes a 'const double' ?

Thanks
sdg


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