Hello, I have this simple doubt: what's the code more properly?And Why?(my question is on the vector "vec") thanks.
string str;
while(file.getline(str)) {
vector<int> vec;
..................
while (parseStr) {
vec.push_back(numberContainedInStr);
}
otherVector.push_back(vec);
}
string str;
while(file.getline(str)) {
vector<int> vec;
..................
while (parseStr) {
vec.push_back(numberContainedInStr);
}
otherVector.push_back(vec);
}
To copy to clipboard, switch view to plain text mode
or
string str;
vector<int> vec;
while(file.getline(str)) {
..................
while (parseStr) {
vec.push_back(numberContainedInStr);
}
otherVector.push_back(vec);
vec.clear();
}
string str;
vector<int> vec;
while(file.getline(str)) {
..................
while (parseStr) {
vec.push_back(numberContainedInStr);
}
otherVector.push_back(vec);
vec.clear();
}
To copy to clipboard, switch view to plain text mode
Bookmarks