Gamgee
You miserable little maggot. I'll stove your head in!
|
#include <short_value_optimized_storage.h>
Public Member Functions | |
ShortValueOptimizedStorage (const uint32_t capacity, const uint32_t short_value_upper_bound) | |
~ShortValueOptimizedStorage () | |
ShortValueOptimizedStorage (ShortValueOptimizedStorage &&other)=default | |
ShortValueOptimizedStorage & | operator= (ShortValueOptimizedStorage &&other)=default |
ShortValueOptimizedStorage (const ShortValueOptimizedStorage &other)=delete | |
ShortValueOptimizedStorage & | operator= (const ShortValueOptimizedStorage &other)=delete |
uint32_t | num_values () const |
Returns the number of values in the container. More... | |
uint32_t | capacity () const |
Returns the maximum number of values the container can hold. More... | |
uint32_t | max_value_length () const |
Returns the length of the longest value in the container. More... | |
uint32_t | value_length (const uint32_t index) const |
Returns the length of the value at the specified position. More... | |
bool | is_set (const uint32_t index) const |
Determines whether there is a value at the specified position. More... | |
std::pair< ELEMENT_TYPE *, uint32_t > | get (const uint32_t index) const |
Gets the value stored at a specified index (first of pair) plus its length in number of items (second of pair) More... | |
void | set (const uint32_t index, const std::vector< ELEMENT_TYPE > &values) |
Set the value at the specified index by vector. More... | |
void | set (const uint32_t index, const ELEMENT_TYPE *values, const uint32_t num_values) |
Set the value at the specified index by pointer. More... | |
void | clear (const uint32_t index) |
Clear the value at a specific index. More... | |
void | clear () |
Reset storage to a pristine state with no values. More... | |
A class for storing arrays of values of varying lengths, optimizing for short arrays (where "short" is custom-defined). "Short" arrays are stored in preallocated contiguous storage, while arrays that don't fit in contiguous storage are dynamically allocated. The idea is to preserve data locality and avoid new memory allocations/deallocations as much as possible. Performance should be good provided that most arrays fall into the "short" category.
This is intended as a more-efficient replacement for vector<vector> in cases where typical inner vector lengths are known in advance.
|
inline |
|
inline |
|
default |
|
delete |
|
inline |
Returns the maximum number of values the container can hold.
|
inline |
Clear the value at a specific index.
|
inline |
Reset storage to a pristine state with no values.
|
inline |
Gets the value stored at a specified index (first of pair) plus its length in number of items (second of pair)
|
inline |
Determines whether there is a value at the specified position.
|
inline |
Returns the length of the longest value in the container.
|
inline |
Returns the number of values in the container.
|
default |
|
delete |
|
inline |
Set the value at the specified index by vector.
|
inline |
Set the value at the specified index by pointer.
|
inline |
Returns the length of the value at the specified position.