initialize variable involving vector data type
<p>I have the following data types and variables:</p>

<pre><code>typedef Seq&lt; vector&lt;int&gt; &gt; MxInt2d;
typedef std::vector&lt;int&gt;  edge_t;
typedef std::vector&lt; edge_t&gt; edge2d_t;

std::vector&lt; edge2d_t &gt; myEdgesIntersect;
</code></pre>

<p>I tried to initialize myEdgesIntersect like:</p>

<pre><code>edge2d_t edge2d(2);

 //creating the vector of edges of intersections whenever an intersection is detected
for (int i=0;i&lt;1;i++){
 edge2d[0][0]=sweepEvents[i][0];
 edge2d[0][1]=sweepEvents[i][1];
 edge2d[1][0]=sweepEvents[i+1][0];
 edge2d[1][1]=sweepEvents[i+1][1];
 std::cout&lt;&lt;edge2d[0][0]&lt;&lt;" "&lt;&lt;edge2d[0][1]&lt;&lt;endl;
 std::cout&lt;&lt;edge2d[1][0]&lt;&lt;" "&lt;&lt;edge2d[1][1]&lt;&lt;endl;
 myEdgesIntersect.push_back(edge2d);
 std::cout&lt;&lt;myEdgesIntersect[i][0][0]&lt;&lt;" "&lt;&lt;myEdgesIntersect[i][0][1]
            &lt;&lt;"    "&lt;&lt;myEdgesIntersect[i][1][0]&lt;&lt;" "&lt;&lt;myEdgesIntersect[i][1][1]&lt;&lt;endl;
}
</code></pre>

<p>But using this syntax when I try to display the variable myEdgesIntersect this is not initialized with the given values of edge2d[..][..] (which during the display are okay). I tried to display the variable myEdgesIntersect before the push_back and I got an bus error, so I think the problem is that the variable is not initialized. I tried to initialize it like:</p>

<pre><code> edge2d_t edge2d;
 edge2d[0][0]=0;
 edge2d[0][0]=0;
 edge2d[0][0]=0;
 edge2d[0][0]=0;
 edge2d[0][0]=0;
 myEdgesIntersect.push_back(edge2d);
</code></pre>

<p>but I got the same error, as actually is the same thing as in the loop. Apparently I do not know how to initialize this quite complicated variable that I really need. If you have any suggestions I would be more than happy.</p>

<p>thanks in advance,
madalina</p>
