MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / consume

Function consume

3rd/asio-1.24.0/include/asio/buffer.hpp:1968–1980  ·  view source on GitHub ↗

@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. * *

Source from the content-addressed store, hash-verified

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
1982private:
1983 std::basic_string<Elem, Traits, Allocator>& string_;

Callers

nothing calls this directly

Calls 3

sizeFunction · 0.70
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected