Fancy Pointers for Fun and Profit
summary
Shows how to implement synthetic pointers that satisfy the standard’s pointer-like requirements and back std::allocator to build relocatable heaps; provides two concrete addressing policies—an offset addressing model (stores signed offsets, null offset = 1) and a 2D “based” model (segment index + offset, 16-byte pointer). Supplies a syn_ptr class template, allocator and storage-model code (on the GitHub link), demos a self-contained DOM that survives memcpy between buffers, and measures performance: sorts with up to 1e6 elements, 10M copy ops; 2D model approaches native speed, offset model is noticeably slower.
AI-written summary · about
chapters (10)
- 0:00Introduction and overview
- 2:02Motivating problem: persistence
- 7:14Concept of relocatable heaps
- 12:48Addressing and memory management
- 20:29Addressing models in practice
- 25:47Implementing synthetic pointers
- 35:02Pointer interface and SFINAE
- 42:01Performance benchmarking
- 45:03Relocatable heap demonstration
- 56:31Summary and conclusions








