| Home | Libraries | People | FAQ | More

#### flat_buffer

##### Synopsis

Defined in header `<boost/beast/core/flat_buffer.hpp>`

    using flat_buffer = basic_flat_buffer< std::allocator< char >>;

##### Types

Name | Description
--- | ---
allocator_type | The type of allocator used.
const_buffers_type | The type used to represent the input sequence as a list of buffers.
mutable_buffers_type | The type used to represent the output sequence as a list of buffers.

##### Member Functions

Name | Description
--- | ---
basic_flat_buffer | Constructor.
capacity | Return the maximum sum of input and output sizes that can be held without an allocation.
commit | Move bytes from the output sequence to the input sequence.
consume | Remove bytes from the input sequence.
data | Get a list of buffers that represent the input sequence.
get_allocator | Returns a copy of the associated allocator.
max_size | Return the maximum sum of the input and output sequence sizes.
operator= | Assignment. Copy assignment.
prepare | Get a list of buffers that represent the output sequence, with the given size.
shrink_to_fit | Reallocate the buffer to fit the input sequence.
size | Returns the size of the input sequence.
~basic_flat_buffer | Destructor.

##### Friends

Name | Description
--- | ---
swap | Exchange two flat buffers.

Objects of this type meet the requirements of DynamicBuffer and offer additional invariants:

- Buffer sequences returned by `basic_flat_buffer::data` and `basic_flat_buffer::prepare` will always be of length one.
- A configurable maximum buffer size may be set upon construction. Attempts to exceed the buffer size will throw `std::length_error`.

Upon construction, a maximum size for the buffer may be specified. If this limit is exceeded, the `std::length_error` exception will be thrown.

##### Remarks

This class is designed for use with algorithms that take dynamic buffers as parameters, and are optimized for the case where the input sequence or output sequence is stored in a single contiguous buffer.

Convenience header `<boost/beast/core.hpp>`