
Bronek Kozicki <brok@rubikon.pl> 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