Loading…
CppCon 2018 has ended
View analytic
Tuesday, September 25 • 09:00 - 10:00
Fancy Pointers for Fun and Profit

Sign up or log in to save this to your schedule and see who's attending!

In modern C++ it is possible to implement user-defined types that closely mimic the behavior of ordinary pointers; these types are often referred to as fancy (or synthetic) pointers. With such types at one's disposal, it becomes feasible to build standard-conforming allocators that support relocatable memory in a way that is compatible with the standard containers. This, in turn, enables the use of the standard containers in applications like shared-memory databases, self-contained private heaps, and lightweight object persistence.

This talk will describe a small set of components that implement synthetic pointers. We'll begin by looking briefly at a couple of motivating problems, and then review how the standard defines "pointer-like types". We'll then discuss how closely a user-defined type can emulate ordinary pointers and sketch out a strategy for implementing such a type using the concepts of addressing model, storage model, and pointer interface.

We'll jump into the deep end by implementing two different addressing models, offset addressing and based 2D addressing, which act as policy types for a synthetic pointer class template. We'll then review simple storage models that support raw memory allocation for both addressing models before examining the synthetic pointer class in detail. We'll discuss how the synthetic pointer class interacts with the addressing models to implement pointer operations and emulate an ordinary pointer's interface.

Finally, the talk will provide an example of how these concepts can be applied - namely, containers in a self-contained private heap.

Speakers
avatar for Bob Steagall

Bob Steagall

CppCon Poster Chair, KEWB Computing
I've been working in C++ since discovering the second edition of The C++ Programming Language in a college bookstore in 1992. The majority of my career has been spent in medical imaging, where I led teams building applications for functional MRI and CT-based cardiac visualization... Read More →


Tuesday September 25, 2018 09:00 - 10:00
Steamboat (403)

Attendees (147)