title: How to return a copy of the data in C++
body: <p>I am trying to return a new copy of the data in a C++ Template class. The following code is getting this error: <code>invalid conversion from 'int' to 'int*'</code>. If I remove the <code>new T</code> then I am not returning a copy of the data but a pointer to it.</p>
  
  <pre><code>template&lt;class T&gt;
  T OrderedList&lt;T&gt;::get( int k )
  {
      Node&lt;T&gt;* n = list;
      for( int i = 0; i &lt; k; i++ )
      {
          n=n-&gt;get_link();
      }
      return new T( n-&gt;get_data() ); // This line is getting the error **********
  }
  </code></pre>