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:
parent
07565c1869
commit
cab2cb8bdc
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user