I am little confused with the applicability of reinterpret_cast vs static_cast. From what I have read the general rules are to use static cast when
reinterpret_cast
static_cast
template outType safe_cast(inType pointer) { void* temp = static_cast(pointer); return static_cast(temp); }
I tried to conclude and wrote a simple safe cast using templates. Note that this solution doesn't guarantee to cast pointers on a functions.