title: error C2440: 'initializing' : cannot convert from 'std::vector<_Ty>' to 'const std::vector<_Ty> &`
body: <p>Question1> Why the following code doesn't work?</p>
  
  <p>Question2> What is the correct way to design it?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include "boost/shared_ptr.hpp"
  
  using namespace std;
  
  class BaseClass
  {};
  
  class SubClass : public BaseClass
  {};
  
  int main()
  {
      std::vector&lt;boost::shared_ptr&lt;SubClass&gt; &gt; vecSubClassShared;
  
      boost::shared_ptr&lt;SubClass&gt; sub1(new SubClass);
  
      vecSubClassShared.push_back(sub1);
  
      // Error    1   error C2440: 'initializing' : cannot convert from 'std::vector&lt;_Ty&gt;' to 'const std::vector&lt;_Ty&gt; &amp;`
      const std::vector&lt;boost::shared_ptr&lt;BaseClass&gt; &gt;&amp; vecBaseShared = vecSubClassShared;
  }
  </code></pre>