Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-13 16:02:35


Peter,

Thanks for taking the time to explain this to me.

So, if I have a generic function which may take a function or a function
object, I am out of luck?

...and will this syntax work with other compilers?

-Dave

----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, November 13, 2001 2:33 PM
Subject: Re: [boost]

> From: "David Abrahams" <david.abrahams_at_[hidden]>
> > Hi Peter,
> >
> > What do I need to do in order to compile this, or something with
> equivalent
> > functionality, on VC6?
> >
> > Thanks,
> > Dave
> >
> > ----
> >
> > struct X
> > {
> > int f(void*, double);
> > };
> >
> > template <class A1>
> > int call(void* obj, int (X::*f)(void*, A1), A1 a1)
> > {
> > boost::bind(
> > boost::bind(f, _1, _2, a1),
> > static_cast<X*>(obj),
> > obj);
> > }
> >
> > int ff(void* obj, double other)
> > {
> > return call(obj, &X::f, other);
> > }
>
> This time you need the <int> on the outer bind (since the first parameter
is
> a function object.) Such is life on MSVC (pre-7.1 ;-) ).
>
> --
> Peter Dimov
> Multi Media Ltd.
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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