Quite often I have the following requirement:
I need a data structure that holds a single header H together with N
elements E. N is constant but not constexpr so just using std::array is
not an option.
Use cases:
- A reference counted store for (small) images. The reference count, the
data size and maybe some meta information is the header while the
picture data is just raw storage.
- A reference counted string with refcount and size as header and an
array of the char type as data.
Normally this always requires two allocations for each object, one for
the header and one for the data. When holding millions of small objects
this can be a considerable overhead.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 493 |
Nodes: | 16 (0 / 16) |
Uptime: | 170:01:23 |
Calls: | 9,703 |
Calls today: | 3 |
Files: | 13,735 |
Messages: | 6,178,353 |