
5 Sep
2004
5 Sep
'04
5:23 p.m.
Bronek Kozicki <brok@rubikon.pl> writes:
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.
Why mess around? You don't need to use a void*; just use a void(X::*)(void) for any X. Round-trip reinterpret_cast is guaranteed to work. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com