I have lots of nodes from CCNode subclasses and some of them have the function ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
.
Now my question is if it's possible to check if they own this particular function with SFINAE.
I tried to make it work with the help of that thread: Is it possible to write a template to check for a function's existence? but I can't.
Here's what I have:
template <typename T>
class hasMethodCCTouchBegan
{
typedef char yes;
typedef long no;
template <typename C> static yes test( decltype(&C::ccTouchBegan) ) ;
template <typename C> static no test(...);
public:
enum { value = sizeof(test<T>(0)) == sizeof(yes) };
};
Honestly I have no clue what to do.