MySQL 9.1.0
Source Code Documentation
|
Code documentation: Containers.
This library contains the following types of containers:
Provides two types of containers. Both containers are used to store sequences of bytes, and both have the following two properties:
The two types of containers are:
Both data structures are intended for the use case where a third-party API requires the user to provide buffers for the API to write to, where the exact size is not known beforehand. Both data structures conveniently provide the cursor position to track the write position, and the grow policy to control memory usage when a bound on the memory is known. The buffer, just like a vector, guarantees that the stored bytes are contiguous in memory, for the price of having to copy existing data to a new location when it grows. The buffer sequence, just like a deque, never needs to copy existing data during a grow operation, but stores bytes non-contiguously.
Both the buffer and the buffer sequence exist as two classes:
Managed_buffer
and Managed_buffer_sequence
manage their own memory, and can grow, and have a cursor position.Buffer_view
and Buffer_sequence_view
are non-owning, non-growable, without a cursor position. They are used to represent views over the read part and the write part of their managed counterparts.Rw_buffer
and Rw_buffer_sequence
are non-owning, non-growable, but have a cursor position. They are not normally used directly, but rather exist in order to separate the "managing" part from the "cursor" part in the implementation.)