boost::capy::basic_vector_dynamic_buffer
A dynamic buffer using an underlying vector.
Description
This class adapts a std::vector of byte‐sized elements to satisfy the DynamicBuffer concept. The vector provides automatic memory management and growth.
Constraints
The element type T must be a fundamental type with sizeof( T ) == 1. This includes char, unsigned char, signed char, and similar byte‐sized fundamental types.
Example
std::vector<unsigned char> v;
vector_dynamic_buffer vb( &v );
// Write data
auto mb = vb.prepare( 100 );
std::memcpy( mb.data(), "hello", 5 );
vb.commit( 5 );
// Read data
auto data = vb.data();
// process data...
vb.consume( 5 );
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 vector type. |
Member Functions
Name |
Description |
|
Constructors |
|
Destructor |
|
Copy assignment is deleted. |
Return the number of writable bytes without reallocation. |
|
Move bytes from the output to the input sequence. |
|
Remove bytes from the beginning of the input sequence. |
|
Return a buffer sequence representing the readable bytes. |
|
Return the maximum number of bytes the buffer can hold. |
|
Return a buffer sequence for writing. |
|
Return the number of readable bytes. |
Template Parameters
| Name | Description |
|---|---|
T |
The element type. Must be fundamental with sizeof 1. |
Allocator |
The allocator type for the vector. |
See Also
flat_dynamic_buffer, circular_dynamic_buffer, string_dynamic_buffer
Created with MrDocs