Template class implementing a monotonically allocated vector of variadic tuples whose first element is of type String .
When new tuples are added with method Add, then memory for copying the provided string is allocated using an internal field of type MonoAllocator . This allows to add single strings, which are allocated in bigger memory chunks.
Standard vector operations, including insertions and deletions are still allowed. In other words, it is allowed to store string objects which are pointing to string data that is not allocated in the internal chunks.
The associated values are especially useful when the vector is sorted (e.g. using std::sort
), because such associations will be kept intact and allow referencing back to whatever the strings represents.
Definition at line 52 of file dbgboxing.hpp.
#include <dbgboxing.hpp>
Public Type Index: | |
using | Base = std::vector<ElementType> |
using | ElementType = std::tuple<String, TAssociatedTypes...> |
Public Field Index: | |
MonoAllocator & | allocator |
Public Method Index: | |
DbgStringTable (MonoAllocator &monoAllocator) | |
template<typename... TArgs> | |
String & | Add (const String &src, TArgs &&... args) |
using Base = std::vector<ElementType> |
Shortcut to the base type of this type.
Definition at line 58 of file dbgboxing.hpp.
using ElementType = std::tuple<String, TAssociatedTypes...> |
Shortcut to the std::tuple
-type that instantiations of this template class store.
Definition at line 55 of file dbgboxing.hpp.
MonoAllocator& allocator |
Allocator for making copies of inserted strings
Definition at line 61 of file dbgboxing.hpp.
|
inline |
Constructor.
monoAllocator | A mono allocator used to create copies of the inserted strings |
Definition at line 67 of file dbgboxing.hpp.
|
inline |
Adds a tuple. The contents of the string of the tuple (its first element) is copied from the given string src . The memory for this string is allocated using the allocator provided in the constructor.
The other members of the tuple added are forwarded from variadic parameter block args .
src | The string to copy into the first member of the tuple. |
args | Variadic arguments to fill the rest of the inserted tuple. |
Definition at line 83 of file dbgboxing.hpp.