I have the following list :
vector<string> mylist;
I want to create a new string that has all the strings in mylist seperated by a comma, for years i'm writing ugly code that checks if i'm in the last string in the vector to know should i add a comma or not.
the code looks something like this :
for(unsigned int i=0;i<mylist.size(); i++)
{
    outstring+=mylist[i];
    if(i<mylist.size()-1) // Avoiding the last comma
    {
        outstring+=",";
    }
}
Is there a trick to avoid the if statement , maybe some algorithms/iterator trick using STL ?
Thanks
 
     
    