C++ primitive for Handle
<p>I am implementing an opaque data structure that is internally an array of opaque data structures. Let's call them records. There will be multiple queries to different fields of a record each with the same key. I have a list of APIs of this form:</p>

<pre><code>QueryFieldX(KEY key, FieldX&amp; Data)
</code></pre>

<p>Each query currently searches through the records with the key and then gets the Data.</p>

<p>I want to change it to the following form:</p>

<pre><code>GetHandleToRecord(KEY key, MYHANDLE handle);
QueryFieldX(MYHANDLE handle, FieldX&amp; Data);
</code></pre>

<p>The advantage is that searching every single time through the records is eliminated. I can implement a MYHANDLE myself but I want to know if there is a good library / data structure / primitive in C++ that gives me an opaque handle that I can use.</p>
