Boost logo

Boost :

From: Maxim Yegorushkin (e-maxim_at_[hidden])
Date: 2004-09-05 03:23:48


Bronek Kozicki <brok_at_[hidden]> wrote:

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

On most compilers the rarity is when the size of function pointer equals
to the size of member function pointer. See
http://www.codeproject.com/cpp/FastDelegate.asp for reference.

Anyway, it looks like the trampoline is not supposed to work with pointers
to non static member functions at all, since it requires passing the
object to apply the pointer to. Or am I missing something?

-- 
Maxim Yegorushkin

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