function returning an iterator of vector
<p>I have this new class Seq that inherits vector and has some additional features. I can use all methods of vector with Seq.
Having this data structure:</p>

<pre><code>Seq&lt; vector&lt;int&gt; &gt; sweepEvents;
</code></pre>

<p>I want to have a function that takes an element vector edge  search for it in sweepEvents and returns the iterator to the position of the found element in sweepEvents (iff edge is found) and the iterator to the last elements of the vector (iff edge is not found)</p>

<p>Then I want to work with this iterator, in that I want to compare the elements from the prev and the next position of iterator.</p>

<p>I have the following function for founding and returning the iterator:</p>

<pre><code>Seq&lt; vector&lt;int&gt; &gt;::iterator QSweep::insertSweepEvents(edge_t edge,int currentDim){
int changePosition;
int found=0;

for (int i=0;i&lt;currentDim;i++){
     if (edge[0]==sweepEvents[i][1]){
   changePosition=i;
   found=1;
   return sweepEvents.begin()+changePosition;
  }
}
if (found==1){
 sweepEvents.rep().insert(sweepEvents.begin()+changePosition,edge);
 sweepEvents.rep().erase(sweepEvents.begin()+changePosition+1);
} 
else{
 sweepEvents.rep().insert(sweepEvents.end(),edge);
}

return sweepEvents.end()-1;
</code></pre>

<p>}</p>

<p>and then I call this iterator in the main function, actually I tried but it does not compile and I do not know what syntax to use other than this</p>

<pre><code>int main(){
    Seq&lt; vector&lt;int&gt; &gt; sweepEvents;
    vector&lt;int&gt; edge;
    //.....initialize sweepEvents and edge

    //declare iterator but not working
     Seq&lt; vector&lt;int&gt; &gt;::iterator comparePosition; 

   //not working neither
    comparePosition=insertSweepEvents(edge,sweepEvents.size());
}
</code></pre>

<p>Any idea on how I should correctly call the iterator? I see it does not work as an integer index from an array?</p>

<p>thank you in advance for your suggestions,
madalina</p>
