I have a structure type like the one shown below, I use it to store the output of my program and these structures are stored in a structure vector.
Now I would like to print out the structures stored in the vector in ascending order of int Time_IF.

struct Input
 int Inst;
 string Instline;
 string DestReg;
 string InputReg1;
 string InputReg2;
 int Time_IF;
 int Time_ID;

I tried printing them out by comparing

    for(int i=0; i<OutputBuffer.size()-1; i++)
       {        if(OutputBuffer[Outputval].Time_IF>OutputBuffer[i+1].Time_IF)

to get the index and then i would print out the respective value


erase the printed structure from the vector

OutputBuffer.erase (OutputBuffer.begin()+Outputval);
reset outputval=0

but i find that some of the structures do not get printed..in this method..
is there a better way of sorting a structure vector based on a parameter in the structure...?