C++: cannot assign vector of pointer to another vector of pointer
<p>I have <code>class Student</code> (<code>studentOwner</code>) and <code>class Section</code>.
Here is my class <code>Student</code>:</p>

<pre><code>class Student {
  vector&lt;Section*&gt; enrolledSections;
public:
  vector&lt;Section*&gt; getEnrolledSections() const { return enrolledSections; }
}
</code></pre>

<p>So, when I get <code>vector&lt;Section*&gt;</code> and assign to another vector, I will meet error. I'm using Microsoft Visual Studio.</p>

<pre><code>// first example: no error, if take size of vector
int a = studentOwner-&gt;getEnrolledSections().size();
// second example: error, when only take its vector and assign again
// Error: no suitable user-define conversion from "std::vector&lt;error-type" ....
vector&lt;Section*&gt; enrolled = studentOwner-&gt;getEnrolledSections();
// third example: error when take this vector and assign to reference of same type
// Error: initial value of reference to non-const value must be lvalue
vector&lt;Section*&gt;&amp; enrolled = studentOwner-&gt;getEnrolledSections();
</code></pre>

<p>Full error at second example is:</p>

<pre><code>Error: no suitable user-define conversion from "std::vector&lt;error-type", std::alocator&lt;&lt;error-type&gt; *&gt;&gt; "to " std::vector&lt;Section*, std::allocator&lt;Section*&gt;&gt;" exists
</code></pre>

<p>In many class of my project, I cannot do line two and line three and received same error. I cannot explain by myself. Please teach me at this point.</p>

<p>Thanks :)</p>
