Improve efficiency of basic_streambuf::consume() by using a single call to

gbump() rather than calling sbumpc() in a loop.
This commit is contained in:
chris_kohlhoff 2008-04-01 21:43:40 +00:00
parent 07565c1869
commit cab2cb8bdc

View File

@ -100,11 +100,9 @@ public:
/// Move the start of the get area by the specified number of characters.
void consume(std::size_t n)
{
while (n > 0)
{
sbumpc();
--n;
}
if (gptr() + n > pptr())
n = pptr() - gptr();
gbump(static_cast<int>(n));
}
protected: