Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-10 20:00:16


"Lin Xu" <risingdragon3_at_[hidden]> writes:

>>But you can't do that ;-)
>>
>>In particular, MemberFun<A,&A::print> is incompatible with, say,
>>MemberFun<A, &A::setz>. You'd need something more like:
>>
>> MemberFun<void(A::*)(), &A::print>
>> MemberFun<void(A::*)(int), &A::setz>
>>
> Sorry, but why? The two functions have different signitures, a::print
> has a void (A::*)(), while setz has void (A::*)(int)..so they have
> different instanitations of Function:
> Function<void>::MemberFun<A,&A::print>
> Function<void,int>::MemberFun<A,&A::setz>

Oh, I didn't realize you were going to plug all the function arguments
into the Function template.

However, wouldn't writing

         MemberFun<void(A::*)(int), &A::setz>

or even:

         MemberFun<void(A,int), &A::setz>

instead of

        Function<void, int>::MemberFun<A, &A::setz>

be a lot simpler?

> Maybe I'm missing something, or I didn't explain things well enough?

I think I just made the wrong assumptions about what your code was
trying to do.

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