Topic: Size and alignment of pointer to member


Author: "Andrei Alexandrescu" <alexandrescua@micromodeling.com>
Date: 1999/02/24
Raw View
I want to store a pointer to a member function in a portable way.
The problem is that I temporary lose type safety, so I would like to
transfer it to raw memory, and then (as I regain type information) to
cast it back to its prior form. This looks a legal attempt on my part,
right?

With regular pointers there's no problem: I just store 'T *' as 'void
*' and then I cast it back to 'T *' which is 100% portable and safe.

How can I achieve the same with pointers to member functions for any
class, of any signature? Note that I *lose* temporarily *any* type
information. I need a kind of 'void *' for member functions. Thanks.

Andrei
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]