@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. * *
| 1966 | * emptied. |
| 1967 | */ |
| 1968 | void consume(std::size_t n) |
| 1969 | { |
| 1970 | #if !defined(ASIO_NO_DYNAMIC_BUFFER_V1) |
| 1971 | if (size_ != (std::numeric_limits<std::size_t>::max)()) |
| 1972 | { |
| 1973 | std::size_t consume_length = (std::min)(n, size_); |
| 1974 | string_.erase(0, consume_length); |
| 1975 | size_ -= consume_length; |
| 1976 | return; |
| 1977 | } |
| 1978 | #endif // !defined(ASIO_NO_DYNAMIC_BUFFER_V1) |
| 1979 | string_.erase(0, n); |
| 1980 | } |
| 1981 | |
| 1982 | private: |
| 1983 | std::basic_string<Elem, Traits, Allocator>& string_; |