特定の条件でNULLを返そうとしていますが、それができません。なぜ、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
}