Some time ago, Emil Ernerfeldt wrote about type safe handles. Simple and interesting.
by Emil Ernerfeldt
From the article:
Let's say you have a system of resources and you identify them using integers as handles. These integers are meaningless to the user, but internally they may be indices into an array, or just a running count...