I have a question regarding list manipulation in C++. I have a list of related filenames, like this:
I would like to be able to find the filename with the extension .c and move it to the end, like so:
I don't care about sorting, I just want the the last item in the list to be the .c file. I know this has got to be easy, I am just not sure whether I should be using swap, sort, splice etc.
Can someone come up with an example? I have started one below:
(btw - looking for a platform independent solution)
for(std::list<std::string>::const_iterator itr=files.begin(); itr != files.end(); itr++)
// determine if this is the file of interest
// what to do here