Any performance penalty for wrapping int in a class?
<p>I have a project with many vectors, sets and maps. In most cases the key/index is an integer. I am considering creating small classes like:</p>

<pre><code>class PhoneRepoIx //index into map {phone_number =&gt; pointer}
{
public:
  int n;
};

class PersonIx //index into map {social_security_number =&gt; pointer}
{
public:
  int n;
};
</code></pre>

<p>Would I incur any speed or memory penalty? With memory I am 90% sure that there would be no memory cost per instance, only per class-type. With speed I am not clear.</p>

<p><strong>Motivation:</strong>
With the above approach, the compiler would do some extra type-checking for me. Also, with well chosen explicit type-names, the reader of my code will see more easily what I am doing. As of now I am using int everywhere and I chose the variable names to express what each index is. With the above, my variable names could be shorter.</p>

<p>Note:
Tyepdefs do not address my issue completely as the compiler would not do any extra type-checking, internally all the types would just be int.</p>
