boost::redis::resp3::flat_tree
A generic response that stores data contiguously.
Description
Implements a container of RESP3 nodes. It's similar to boost::redis::resp3::tree, but node data is stored contiguously. This allows for amortized no allocations when re‐using flat_tree objects. Like tree, it can contain the response to several Redis commands or several server pushes. Use get_total_msgs to obtain how many responses this object contains.
Objects are typically created by the user and passed to connection::async_exec to be used as response containers. Once populated, they can be used as a const range of resp3::node_view objects. The usual random access range methods (like at, size or front) are provided. Once populated, flat_tree can't be modified, except for clear and assignment.
flat_tree models std::ranges::contiguous_range.
A flat_tree is conceptually similar to a pair of std::vector objects, one holding resp3::node_view objects, and another owning the the string data that these views point to. The node capacity and the data capacity are the capacities of these two vectors.
Member Functions
Name |
Description |
|
Constructors |
Assignment operators |
|
Returns an iterator to the first element of the node range. |
|
Returns an iterator past the last element in the node range. |
|
Returns an iterator to the first element of the reversed node range. |
|
Returns an iterator past the last element of the reversed node range. |
|
Returns a reference to the node at the specified position (checked access). |
|
Returns a reference to the node at the specified position (unchecked access). |
|
Returns a reference to the first node. |
|
Returns a reference to the last node. |
|
Returns a pointer to the underlying node storage. |
|
Checks whether the tree is empty. |
|
Returns the number of nodes in the tree. |
|
Reserves capacity for incoming data. |
|
Clears the tree so it contains no nodes. |
|
Returns the size of the data buffer, in bytes. |
|
Returns the capacity of the node container. |
|
Returns the capacity of the data buffer, in bytes. |
|
Returns the number of memory reallocations that took place in the data buffer. |
|
Returns the number of complete RESP3 messages contained in this object. |
Non-Member Functions
Name |
Description |
Inequality operator. |
|
Equality operator. |
Created with MrDocs