title: compiler error for shared_ptr in Visual Studio 2010
body: <p>Converting a project from Codeblocks to Visual Studio I encountered this puzzling error from the compiler:</p>
  
  <pre><code>Error   4   error C2228: left of '.swap' must have class/struct/union
  shared_ptr.hpp
  
  Error   3   error C2440: '&lt;function-style-cast&gt;' : cannot convert from
  'boost::shared_ptr&lt;T&gt;' to 'boost::shared_ptr&lt;T&gt;' shared_ptr.hpp 384
  </code></pre>
  
  <p>Here's the code in question in boost's shared_ptr.hpp</p>
  
  <pre><code>template&lt;class Y&gt;
  shared_ptr &amp; operator=( shared_ptr&lt;Y&gt; &amp;&amp; r ) // never throws
  {
      this_type( static_cast&lt; shared_ptr&lt;Y&gt; &amp;&amp; &gt;( r ) ).swap( *this );
      return *this;
  }
  </code></pre>
  
  <p>I set up a similar but less complicated project and did not get the same error. </p>