Add some special cases to line_iterator that makes it significantly faster in common cases

Originally committed to SVN as r5534.
This commit is contained in:
Thomas Goyne 2011-08-17 05:32:01 +00:00
parent 561216d4c8
commit 330411c94a

View file

@ -191,12 +191,21 @@ void line_iterator<OutputType>::next() {
valid = false; valid = false;
return; return;
} }
std::string str; std::string str, cstr, *target;
getline(str); if (width == 1) {
if (conv.get()) { std::getline(*stream, str);
str = conv->Convert(str);
} }
if (!convert(str)) { else {
getline(str);
}
if (conv.get()) {
conv->Convert(str, cstr);
target = &cstr;
}
else {
target = &str;
}
if (!convert(*target)) {
next(); next();
return; return;
} }