Plus, he could have reduced lines even further to get down to about 6, like
vector<string> data; string line; for (ifstream ifile(argv[1]); getline(ifile, line);) data.push_back(line); sort(begin(data), end(data)); copy(begin(data), end(data), ostream_iterator<string>(ofstream(argv[2]), "\n"));
Unfortunately we work with iterator pairs in C++; if we had ranges like D does, we could turn those last two into
copy(sort(data), ...)
Plus, he could have reduced lines even further to get down to about 6, like
And his `return 0` was superfluous so I removed it.Unfortunately we work with iterator pairs in C++; if we had ranges like D does, we could turn those last two into
but alas we cannot.