I would like to copy the contents of a vector
to one long string
with a custom delimiter. So far, I\'ve tried:
// .h
string getLabe
string join(const vector & v, const string & delimiter = ",") {
string out;
if (auto i = v.begin(), e = v.end(); i != e) {
out += *i++;
for (; i != e; ++i) out.append(delimiter).append(*i);
}
return out;
}
A few points: