As some of you may know, I have been developing a library with custom allocators that provide custom pointers - the goal fo this has been to absolutely minimize the memory footprint of the datastructures themselves.
The primary mechanism to achieve this reduction have been custom pointer types, such types that only store the bare minimum information that they then use together with the information stored in their static storage member to resolve into a full real pointer.
An example to help you imagine would be the offset_ptr : directly stores the offset as a member variable, usually in a very narrow type like the uint8_t, and then when the time comes and they need to resolve into a real ponter, they access the static storage, look up the base address for the memory region, and just do offset arithmetic to find out the real pointer.
The trick, and what is doing the heavy lifting here is the static_storage itself - it's a special static member, whose type is parametrized on a lambda.
The lambdas type is captures in the allocators type, then passed down to the pointer_type- so the allocator is always responsible for the creation and the provision of the custom pointer type.
Since the static storage member is in both the pointer and allocator is parametrized on the same unique lambda type, it's the same static storage, and therefore both the pointer and the allocator can used is as a sort of a "shared memory" region.
The advantage of this is very light pointer size.
The main disadvantage is the fact that it forces the allocators and the pointers to be unique types (this makes them more difficult to work with and make it impossible to move them accoss TU boundaries).
I now wish to create an IPC library from my queue & allocators. I like the idea of light pointers, but in the current state they are too cumbersome to use.
Can I somehow refactor/rearchitect, so that the custom pointers will be a great addition in the IPC library?