From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-09-05 01:48:08
Rob Stewart wrote:
>> static_assert<sizeof(Functor*) == sizeof(void *)> size;
>> union convert
>> Functor* f;
>> void* p;
> What if a void * and a pmf are not the same size? You at least
> need a static assertion to that effect, right?
Yep. I believe that it's rare, but in any case assertion is in place.
>> static void exec(void * p)
> Unfortunately, the type of exec is
> void (_lever_t<Function *>::*)(void *)
> void (*)(void *)
> as you've declared _pf_t. Thus, on any compiler that uses a
> different function pointer type for pointers to member functions
> and regular function pointers, will fail to compile this code.
No. exec is static member function. I'm pretty sure that its address can
be used to initialize regular function pointer, and that it's portable
and guaranteed by C++ standard. Futhermore, I'm quite sure that type you
mention is not applicable to static members of class.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk