|
Boost : |
From: Lin Xu (risingdragon3_at_[hidden])
Date: 2003-02-10 19:31:05
>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>
But they do have different types, if that's what you are saying. But I don't
see why having the same type is desirable. So long each MemberFun has a
static Call() function, the user doesn't particularly care about the type:
//continuing on from the previous code:
typedef .... Properties;
Properties::Item<Props::Print>::Call(p);
Since this is fully at compile time, there is no need to actually declare a
variable of Function type, which would require the MemberFun to have the
same type.
Maybe I'm missing something, or I didn't explain things well enough?
Thanks.
Lin Xu.
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk