我试图在某种条件下返回 NULL,但它不会让我,为什么不,我怎样才能让它返回一个空值或 0?
struct Entity
{
USHORT X;
USHORT Y;
UINT Serial;
USHORT SpriteID;
EntityType Type;
Direction FacingDirection;
};
功能是:
Entity& GetEntityAt(int index)
{
if (!GameObjects.empty())
{
lock_guard<mutex> lock(PadLock);
Entity& result = GameObjects[index];
return result;
}
return NULL; // <- this won't compile
}