@b DynamicBuffer_v1: Remove characters from the input sequence. @b DynamicBuffer_v2: Consume the specified number of bytes from the beginning of the underlying memory. * @b DynamicBuffer_v1: Removes @c n characters from the beginning of the * input sequence. @note If @c n is greater than the size of the input * sequence, the entire input sequence is consumed and no error is issued. * *
| 1790 | * emptied. |
| 1791 | */ |
| 1792 | void consume(std::size_t n) |
| 1793 | { |
| 1794 | #if !defined(ASIO_NO_DYNAMIC_BUFFER_V1) |
| 1795 | if (size_ != (std::numeric_limits<std::size_t>::max)()) |
| 1796 | { |
| 1797 | std::size_t consume_length = (std::min)(n, size_); |
| 1798 | string_.erase(0, consume_length); |
| 1799 | size_ -= consume_length; |
| 1800 | return; |
| 1801 | } |
| 1802 | #endif // !defined(ASIO_NO_DYNAMIC_BUFFER_V1) |
| 1803 | string_.erase(0, n); |
| 1804 | } |
| 1805 | |
| 1806 | private: |
| 1807 | std::basic_string<Elem, Traits, Allocator>& string_; |