boost::capy::basic_string_dynamic_buffer
A dynamic buffer backed by a std::basic_string.
Synopsis
template<
class CharT,
class Traits = std::char_traits<CharT>,
class Allocator = std::allocator<CharT>>
class basic_string_dynamic_buffer;
Description
This adapter wraps an externally‐owned string and exposes it through the DynamicBuffer interface. Readable bytes occupy the front of the string; writable bytes are appended by prepare and made readable by commit.
|
The wrapped string must outlive this adapter. Calls to |
Example
std::string s;
auto buf = dynamic_buffer( s, 4096 );
auto mb = buf.prepare( 100 );
// fill mb with data...
buf.commit( 100 );
// buf.data() now has 100 readable bytes
buf.consume( 50 );
Types
Name |
Description |
The ConstBufferSequence type for readable bytes. |
|
Indicates this is a DynamicBuffer adapter over external storage. |
|
The MutableBufferSequence type for writable bytes. |
|
The underlying string type. |
Member Functions
Name |
Description |
|
Constructors |
|
Destroy the buffer. |
|
Copy assignment is deleted. |
Return the number of writable bytes without reallocation. |
|
Move bytes from the writable to the readable area. |
|
Remove bytes from the beginning of the readable area. |
|
Return a buffer sequence representing the readable bytes. |
|
Return the maximum number of bytes the buffer can hold. |
|
Prepare writable space of at least |
|
Return the number of readable bytes. |
Template Parameters
| Name | Description |
|---|---|
CharT |
The character type. |
Traits |
The character traits type. |
Allocator |
The allocator type. |
See Also
DynamicBuffer, string_dynamic_buffer, dynamic_buffer
Created with MrDocs