title: Trying to assign vector of Base* from vector of Derived*
body: <p>This seems like a pretty basic problem, but I can't figure it out.  I have a <code>std::vector</code> of raw pointers to Derived objects, and I just want to copy it to another vector of Base pointers using the assignment operator.  With VC++ I get error C2679 "binary '=': no operator found..."  BTW I don't want a deep copy of the objects, I just want to copy the pointers.  Sample code:</p>
  
  <pre><code>#include &lt;vector&gt;
  using namespace std;
  
  struct Base{};    
  struct Derived: public Base {};
  
  int main (int argc, char* argv[])
  {
      vector&lt;Derived*&gt; V1;
      vector&lt;Base*&gt; V2;
      V2 = V1;  //Compiler error here
      return 0;
  }
  </code></pre>
  
  <p>What confuses me is that I can copy the vector by looping through it and using <code>push_back</code>, like this:</p>
  
  <pre><code>for (Derived* p_derived : V1)
      V2.push_back(p_derived);
  </code></pre>
  
  <p>So my question is why does the assignment fail, while <code>push_back</code> works?  Seems like the same thing to me.</p>