Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

flat_buffer

A flat buffer which uses the default allocator.

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 ConstBufferSequence used to represent the readable bytes.

mutable_buffers_type

The MutableBufferSequence used to represent the writable bytes.

Member Functions

Name

Description

basic_flat_buffer

Constructor.

Move Constructor.

Copy Constructor.

capacity

Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation.

cdata

Returns a constant buffer sequence representing the readable bytes.

clear

Set the size of the readable and writable bytes to zero.

commit

Append writable bytes to the readable bytes.

consume

Remove bytes from beginning of the readable bytes.

data

Returns a constant buffer sequence representing the readable bytes.

Returns a mutable buffer sequence representing the readable bytes.

get_allocator

Returns a copy of the allocator used.

max_size

Set the maximum allowed capacity.

Return the maximum number of bytes, both readable and writable, that can ever be held.

operator=

Move Assignment.

Copy Assignment.

Copy assignment.

prepare

Returns a mutable buffer sequence representing writable bytes.

reserve

Guarantee a minimum capacity.

shrink_to_fit

Request the removal of unused capacity.

size

Returns the number of readable bytes.

~basic_flat_buffer [destructor]

Destructor.

Friends

Name

Description

swap

Exchange two dynamic buffers.

A dynamic buffer encapsulates memory storage that may be automatically resized as required, where the memory is divided into two regions: readable bytes followed by writable bytes. These memory regions are internal to the dynamic buffer, but direct access to the elements is provided to permit them to be efficiently used with I/O operations.

Objects of this type meet the requirements of DynamicBuffer and have the following additional properties:

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.


PrevUpHomeNext