For example I have class hierarchy:
Object <- MyObject
Object <- MenuItem
class MyObject: public Object {
void handler(MenuItem* item);
}
Is it safe to cast void(MyObject::*)(MenuItem*) to
void(Object::*)(Object*)? Or I should use MULATE_FUNCTION_POINTER_CASTS=1
in this case too?
I thinking about replacing static_cast<> with less strict check:
template <typename R, typename O, typename ... Types>
cocos2d::SEL_MenuHandler menu_selector(R(O::*f)(Types ...)) {
static_assert(std::is_same<std::integral_constant<int, sizeof
...(Types)>, std::integral_constant<int, 1>>::value,
"menu_selector should accept one argument - CCObject*");
return (cocos2d::SEL_MenuHandler) f;
}
The idea of this code is to check argument count of menu handler function,
and if it matches - cast it. Is it safe?
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.