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

Function prepare

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

@b DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. * Ensures that the output sequence can accommodate @c n bytes, resizing the * basic_string object as necessary. * * @returns An object of type @c mutable_buffers_type that satisfies * MutableBufferSequence requirements, representing basic_string memory * at the start of the output se

Source from the content-addressed store, hash-verified

1888 * output sequence.
1889 */
1890 mutable_buffers_type prepare(std::size_t n)
1891 {
1892 if (size() > max_size() || max_size() - size() < n)
1893 {
1894 std::length_error ex("dynamic_string_buffer too long");
1895 asio::detail::throw_exception(ex);
1896 }
1897
1898 if (size_ == (std::numeric_limits<std::size_t>::max)())
1899 size_ = string_.size(); // Enable v1 behaviour.
1900
1901 string_.resize(size_ + n);
1902
1903 return asio::buffer(asio::buffer(string_) + size_, n);
1904 }
1905
1906 /// @b DynamicBuffer_v1: Move bytes from the output sequence to the input
1907 /// sequence.

Callers

nothing calls this directly

Calls 6

throw_exceptionFunction · 0.85
bufferFunction · 0.85
sizeFunction · 0.70
max_sizeFunction · 0.70
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected