1519 {
1520 line.clear();
1521
1522 std::istream::sentry sentry{input, true};
1523 auto sb = input.rdbuf();
1524
1525 while(true) {
1526 auto c = sb->sbumpc();
1527 if(c == '\r') {
1528 if(sb->sgetc() == '\n') c = sb->sbumpc();
1529 }
1530
1531 if(c == '\n') return input;
1532
1533 if(c == std::istream::traits_type::eof()) {
1534 if(line.empty()) input.setstate(std::ios::eofbit);
1535 return input;
1536 }
1537
1538 line.push_back(static_cast<char>(c));
1539 }
1540}