Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-05-20 11:27:14


David Abrahams <dave_at_[hidden]> writes:

> I don't see how this can work.
>
> P p;
> Q q;
>
> extern "C" int (*f1)(int)
> = make_c_function<P,int(int)>(boost::bind(&p,P::foo,_1));
>
> extern "C" int (*f2)(int)
> = make_c_function<P,int(int)>(boost::bind(&q,P::foo,_1));
>
> Don't these call the same function with the same stored data?
>
> ooh, sneaky idea... do you specailize a class template on the address
> of the argument to make_c_function, thus generating unique functions?

Oh, of course you can't do that; the argument is a runtime argument.
How can it possibly work?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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