Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This if statement is just for a certain sorting method passed from main. If its values then I sort by the string of the vector.
- if(value_key == "values")
- {
- //This vector is as such vector<pair <string,int > > myVector
- //Also defined in a class previously
- //what i thought was happening here was i set VectIt to the begining of my filled vector then I advanced that iterator by 1 so its now in the next vector slot. And I wanted it to do this loop till it reached the end of the vector increasing VecIt every time by one.
- for((VecIt = myVector.begin())+1;VecIt!=myVector.end();VecIt++)
- {
- //Here on out I tried to throw something together from the book. Accept my book used an array. It mentioned something about having a KEY value. Which I don't know how to relate to my vector. Also it used i and j a lot. I'm just confused.
- tmpIt = VecIt - 1; //tmpIt is another iterator defined in a class earlier on.
- while(tmpIt->first > "0" && tmpIt->first > VecIt->first)
- {
- VecIt = tmpIt;
- tmpIt = tmpIt-1;
- }
- tmpIt+1 = VecIt;
- }
Advertisement
Add Comment
Please, Sign In to add comment