
10 May
2011
10 May
'11
8:06 a.m.
Hi all, Hi
My requirement is to cast an object of type shared_ptr as void*, so that I can send it to a callback function that accepts a void*. I cannot change callback the function signature because it is part of an existing legacy code.
You can get the raw-pointer using the member-function get() or the free function get_pointer (which should be prefered). smart_ptr<Class> ptr(new Class); Class * raw_ptr = get_pointer(ptr); You can cast the raw-pointer to void* of course. -- Best regards, michi7x7