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