I want to populate a istringstream object with content from vector of strings. Is there an elegant way to do this? I am doing the following now, which is not nice:
vector<string> vec = {"apple", "banana", "dog", "cat"};
string one_str;
for (string s: vec) {
one_str += s + " ";
}
istringstream iss(one_str);
Aucun commentaire:
Enregistrer un commentaire