Unless someone can explain to me why it was written the way it was, I'm going to pretend it was a bug.

The intent was to let you use several filenames, possibly with wildcards, such as 'foo bar* wurdle' and have it process 'foo bar1 bar2 wurdle' in that order. With your changes it would append the wildcard results to the end and result in 'foo wurdle bar1 bar2'. Note that L.insert(L.end(),X) is the same as L.push_back(X).

However, the original code was wrong too. The insert method inserts before the iterator, and insert on lists doesn't move iterators, so the it++ was bogus. Try just removing that...