const TypedeffedIntPointer not equal to const int *
<p>I have the following C++ code:</p>

<pre><code>typedef int* IntPtr;
const int* cip = new int;
const IntPtr ctip4 = cip;
</code></pre>

<p>I compile this with Visual Studio 2008 and get the following error:</p>

<blockquote>
  <p>error C2440: 'initializing' : cannot convert from 'const int *' to 'const IntPtr'</p>
</blockquote>

<p>Clearly my understanding of typedefs is not what is should be.</p>

<p>The reason I'm asking, I'm storing a pointer type in a STL map. I have a function that returns a const pointer which I would like to use to search in the map (using map::find(const key_type&amp;). Since </p>

<pre><code>const MyType* 
</code></pre>

<p>and </p>

<pre><code>const map&lt;MyType*, somedata&gt;::key_type
</code></pre>

<p>is incompatible, I'm having problems.</p>

<p>Regards
Dirk</p>
