The code here uses 'const void *' because it doesn't require the compiler to have any knowledge of the specific type contained in the RefPtr<T>. This allows the RefPtr<T> to be used with types that are forward declared and included in modules that have no knowledge of the type pointed to, because any pointer can be cast to a const void*.

For example suppose we have the following in 'Enemy.h':

namespace cocos2d
{
    class Sprite;
}

class Enemy
{
public:
   void doStuff();

private:
   RefPtr<cocos2d::Sprite>  mSprite;
};

If another file 'AI.cpp' wanted to call doStuff() on an enemy it could do so without having to include the header for sprite:

#include "Enemy.h"

void AI::doTick(Enemy & enemy)
{
   enemy.doStuff();
   // Do other stuff...
}

If we were to use const Ref* it would require the compiler to have knowledge of the type in the module where the header was included. Which means we'd have to change 'Enemy.h' to look something like this:

#include <CCSprite.h>

class Enemy
{
public:
   void doStuff();

private:
   RefPtr<cocos2d::Sprite>  mSprite;
};

In this case it's not a huge problem, but in a large codebase with many headers we could end up with a lot of headers cross including each other unknowingly and this might cause issues such as circular includes etc. Essentially it's a tradeoff between minimising dependencies between headers some loss of type information. Originally the code was working the way you suggested (like in cocos2d::Vector<T>) but we switched to this method because of problems with headers cross including each other.

Do you think it's the right trade off for cocos2d-x, or should we switch back to the Vector<T> method instead?