4 ms·
I like this, but I also think some of the benefits can be had independently by combining several complementary techniques (in C++). The allocation can be handl
by jcarrano 3y ago
I like this, but I also think some of the benefits can be had independently by combining several complementary techniques (in C++).
The allocation can be handled by custom allocators for each object type. You can do only this and you avoid the double de-reference of handles.
If you are fine with double-dereferences and also want to implement extra checks and use less bits for the pointer you could overload `operator->()`, e.g.
struct CompressedPointer {
uint16_t obj_id;
Object \*operator->() { return Object::get_by_id(obj_id); }
};