What design pattern to use here?

This is a discussion on What design pattern to use here? within the C++ Programming forums, part of the General Programming Boards category; Hey,
I am working on a "game engine" and right now Im trying to implement the part of it that ...

Right now I am keeping lightID as a global and increment it every time I create a new light. It works, but I would prefer to avoid using globals. Also, if I delete a light, there is no way of telling that that id is now free.

...where the int is the OpenGL light id. LM keeps a map of lights, keyed by light id. LightManager can shield the client classes from OpenGL altogether if you make the parameters generic enough and consider the returned id a "handle".