samedi 18 février 2017

What's the name of this handle/ID pattern?

Where you have an array of elements + generation values (integers) and the handle is made of the index of the element and the current generation at this index (for example 16 bits for each, forming a 32 bits handle).

The generation in the array is incremented when the element is destroyed, this way you can tell if the handle is referencing the element that is currently at this index, or a previous element that has been destroyed and replaced by another element at the same index.

I've read about this pattern somewhere but I don't remember where. Anybody knows if it has a name or knows some place where I could learn more about it?

Aucun commentaire:

Enregistrer un commentaire