boost::capy::basic_vector_dynamic_buffer
A dynamic buffer using an underlying vector.
Synopsis
template<
class T,
class Allocator = std::allocator<T>>
requires std::is_fundamental_v<T> && (sizeof(T) == 1)
class basic_vector_dynamic_buffer;
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 );
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