title: GCC shared_ptr Template Error
body: <p>The following function</p>
  
  <pre><code>#include &lt;memory&gt;
  
  template&lt;typename T&gt;
  std::shared_ptr&lt;typename T&gt; Tail(const std::shared_ptr&lt;typename T&gt;&amp; cont, size_t n)
  {
     const auto size(std::min&lt;size_t&gt;(n, cont-&gt;size()));
     return std::shared_ptr&lt;typename T&gt;(new T(cont-&gt;end() - size, cont-&gt;end()));
  }
  </code></pre>
  
  <p>Produces the following error on gcc 4.7.2.</p>
  
  <pre><code>g++ test.cpp -std=c++0x
  test.cpp:4:27: error: template argument 1 is invalid
  test.cpp:4:66: error: template argument 1 is invalid
  test.cpp: In function ‘int Tail(const int&amp;, size_t)’:
  test.cpp:6:42: error: base operand of ‘-&gt;’ is not a pointer
  test.cpp:7:35: error: template argument 1 is invalid
  test.cpp:7:47: error: base operand of ‘-&gt;’ is not a pointer
  test.cpp:7:67: error: base operand of ‘-&gt;’ is not a pointer
  </code></pre>
  
  <p>I understand that cont does not 'look' like a pointer, but this compiles fine on VS2012.
  How can I write the function for gcc?</p>