How to implement remove_reference
<p>I'm learning type traits and type transformation (modification?), so I came across <code>std::remove_reference</code>. I tried to implement it like this:</p>

<pre><code>template &lt;class T&gt;
struct remove_reference { typedef T type; };

template &lt;class T&gt;
struct remove_reference&lt;const T&gt; { typedef const T type; };

template &lt;class T&gt;
struct remove_reference&lt;T&amp;&gt; { typedef T type; };

template &lt;class T&gt;
struct remove_reference&lt;const T&amp;&gt; { typedef const T type; };
</code></pre>

<p>Now when I use it:</p>

<pre><code>remove_reference&lt;int&gt;::type x1;        // x1 is int : Ok
remove_reference&lt;const int&gt;::type x2;  // x2 is &lt;type&gt; : ???
remove_reference&lt;int&amp;&gt;::type x3;       // x3 is int : Ok
remove_reference&lt;const int&amp;&gt;::type x4; // x4 is &lt;type&gt; : ???
</code></pre>

<p>I'm using Visual Studio 2015 and it tells me the type of <code>x2</code> and <code>x4</code> is <code>&lt;type&gt;</code> so what am I missing here ? </p>

<p>Note:</p>

<ol>
<li>I'm doing <code>{ typedef const T type }</code> to remove reference and keep constness...</li>
<li>I don't know C++ standard implementation of std::remove_reference</li>
</ol>

<p>Edit: There is nothing wrong with std::remove_reference, I'm just doing this for sake of learning ... </p>