...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
To facilitate working with instances of the ConstBufferSequence and MutableBufferSequence concepts introduced in Boost.Asio, Beast treats those sequences as a special type of range. The following algorithms and wrappers are provided which transform these ranges efficiently using lazy evaluation. No memory allocations are used in the transformations; instead, they create lightweight iterators over the existing, unmodified memory buffers. Control of buffers is retained by the caller; ownership is not transferred.
Table 1.7. Buffer Algorithms and Types
Name |
Description |
---|---|
This is a more reliable version of |
|
This functions returns a new buffer sequence which, when iterated,
traverses the sequence which would be formed if all of the input
buffer sequences were concatenated. With this routine, multiple
calls to a stream's |
|
This class represents the buffer sequence formed by concatenating
two or more buffer sequences. This is type of object returned by
|
|
This function returns the first buffer in a buffer sequence, or a buffer of size zero if the buffer sequence has no elements. |
|
This function returns a new buffer or buffer sequence which represents a prefix of the original buffers. |
|
This class represents the buffer sequence formed from a prefix
of an existing buffer sequence. This is the type of buffer returned
by |
|
This function returns an iterable range representing the passed buffer sequence. The values obtained when iterating the range will always be a constant buffer, unless the underlying buffer sequence is mutable, in which case the value obtained when iterating will be a mutable buffer. It is intended as a notational convenience when writing a range-for statement over a buffer sequence.
The function |
|
This class wraps the underlying memory of an existing buffer sequence and presents a suffix of the original sequence. The length of the suffix may be progressively shortened. This lets callers work with sequential increments of a buffer sequence. |
|
This function converts a buffer sequence to a |
The DynamicBuffer concept introduced in Boost.Asio models a buffer sequence which supports an owning, resizable range. Beast provides this set of additional implementations of the dynamic buffer concept:
Table 1.8. Dynamic Buffer Implementations
Name |
Description |
---|---|
This wrapper adapts any MutableBufferSequence into a DynamicBuffer with an upper limit on the total size of the input and output areas equal to the size of the underlying mutable buffer sequence. The implementation does not perform heap allocations. |
|
Guarantees that input and output areas are buffer sequences with length one. Upon construction an optional upper limit to the total size of the input and output areas may be set. The basic container is an AllocatorAwareContainer. |
|
Uses a sequence of one or more character arrays of varying sizes. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence. The basic container is an AllocatorAwareContainer. |
|
Guarantees that input and output areas are buffer sequences with length one. Provides the facilities of a dynamic buffer, subject to an upper limit placed on the total size of the input and output areas defined by a constexpr template parameter. The storage for the sequences are kept in the class; the implementation does not perform heap allocations. |
|
Provides the facilities of a circular dynamic buffer. subject to an upper limit placed on the total size of the input and output areas defined by a constexpr template parameter. The implementation never moves memory during buffer operations. The storage for the sequences are kept in the class; the implementation does not perform heap allocations. |
These two functions facilitate buffer interoperability with standard output streams.
Table 1.9. Buffer Output Streams
Name |
Description |
---|---|
This function wraps a ConstBufferSequence
so it may be used with |
|
This function returns a |
These type traits are provided to facilitate writing compile-time metafunctions which operate on buffers:
Table 1.10. Buffer Algorithms and Types
Name |
Description |
---|---|
This metafunction is used to determine the type of iterator used by a particular buffer sequence. |
|
This metafunction is used to determine the underlying buffer type for a list of buffer sequence. The equivalent type of the alias will vary depending on the template type argument. |
|
This metafunction is used to determine if all of the specified
types meet the requirements of ConstBufferSequence.
This type alias will be |
|
This metafunction is used to determine if all of the specified
types meet the requirements of MutableBufferSequence.
This type alias will be |