Vector array of pointers of type struct in CPP : <p>I have a structure:</p>

<pre><code>struct node{

int data;
int rank;
node* ptr;
};
</code></pre>

<p>After that I have defined a class as follows: The structure is outside the class.</p>

<pre><code>class A{

     private:
     vector&lt;node*&gt; update(int searchKey);

     ....some more functions...

     const int maxLevel;
     };
</code></pre>

<p>Now when I write definition of this function I write it as follow:</p>

<pre><code> std::vector&lt;node*&gt;A::update(int searchKey)
{
   vector&lt;node*&gt; result(maxLevel,0);   // 0 signifies a nullptr here

 .......some code that fills the vector declared above......

  return result;
}
</code></pre>

<p>The value of maxLevel is initialized in the constructor for the class as follow:</p>

<pre><code>A::A():maxLevel(10)
{
  some more code...
}
</code></pre>

<p>Running the code gives me the following error:</p>

<blockquote>
  <p>/usr/include/c++/5/bits/stl_vector.h:1252:22: error: invalid conversion from ‘int’ to ‘std::vector::value_type {aka node*}’ [-fpermissive]
      _M_fill_initialize(static_cast(__n), __value);</p>
</blockquote>

<p>I have tried many changes but I keep getting the error. What is that I am doing wrong? Please let me know if I am missing some details in the question.Thanks</p>
