title: STL vector used in managed code
body: <p>OS : xp<br>
  IDE : VS 2008<br>
  In the project that i'm doing in visual C++ i have declared a <code>std::vector</code> inside managed class as so</p>
  
  <pre><code>std::vector&lt;pts&gt; dataPoints;//this gives error c4368 : mixed type not allowed 
  </code></pre>
  
  <p>but this works</p>
  
  <pre><code>std::vector&lt;pts&gt; * dataPoints;//a pointer to the vector  
  </code></pre>
  
  <p>i then have created this vector on the free store as so in the constructor of the managed class  </p>
  
  <pre><code>dataPoints = new std::vector&lt;pts&gt;(noOfElements,pts());//which is not so attractive.
  </code></pre>
  
  <p>the reason i need vector is because there is file that i'm reading through the <code>ifstream</code> and storing those values in the vector.<br>
  Q1) why is that i'm able to declare a pointer to object of native type(i guess)but not an object?
  furthermore, prior to trying vector i tried the managed array as so</p>
  
  <pre><code>cli::array&lt;Point&gt; dataPoints //and i defined it later.
  </code></pre>
  
  <p>but when i do this</p>
  
  <pre><code>ifile &gt;&gt; dataPoints[i].X;   
  </code></pre>
  
  <p>it gives an error c2678 : operator= is not overloaded for <code>int</code>!!.<br>
  Q2) why is it that i cant use a managed code here. At first i thought it might be a wrapper class Int but then autounboxing(conversion operators) should take care of it?or is it that Point::X is qualified with <code>property</code> and thus is not recognized as normal <code>int</code>? what am i missing?.
  this is the reason i went for <code>vector</code> and <code>pts</code>  solution.<br>
  <code>pts</code> is as follows</p>
  
  <pre><code> struct pts
  {
    int X, int Y;
    pts() : X(0),Y(0){}
    pts(int x,int y) : X(x),Y(y){}
  };//this i created to store the data from the file.
  </code></pre>