CCNode based class cannot be used as functor, otherwise crash

Not sure if anyone found this before.

Let’s say u have:

class MyClass : public CCNode
{
public:
bool operator() (xxx, xxx); // try to use the class as functor to be used in std::sort
….
}

then if you add this class instance to other node, crash will happen when you try to remove it either by removeFromParentAndCleanup or removeChildByTag.

Workaround is to use global function and static variables for customized sort comparison, but wonder why CCNode cannot be used as functor ?

Environment: cocos2d-x 2.1.5, XCode 5.2