As of a couple days ago, the sessions I presented at C++Now 2018 are up on YouTube! (They are not captioned yet, but I’m working on it.)
“An Allocator is a Handle to a Heap”: A memory resource is an object type. An allocator (in the C++-allocator-model sense) is a handle to a memory resource, which makes it a value type. This is obvious in the
std::pmrworld, but true even when it’s not obvious. (An allocator can have other orthogonal bits besides just the handle. “Sticky” allocators, like
std::pmr::polymorphic_allocator, have a whole bunch of pitfalls.) Discussion of how allocators, and fancy pointers, form “rebindable families.”
“The Best Type Traits C++ Doesn’t Have”: First, the vast majority of standard C++ types are trivially relocatable, which essentially means your
realloc(or at least
memcpy) under the hood, even for non-trivially-moveable types. Second, many types are trivially comparable, which essentially means your
memcmpunder the hood. (It’s easier to be trivially comparable on a big-endian system.) Thirdly, I present a mechanism called tombstone traits which shrinks the size of an
Klevels deep) from libc++’s current
sizeof(T) + 8*Kbytes to a constant
sizeof(T) + 8bytes (and in fact
I have submitted “An Allocator is a Handle to a Heap” for CppCon 2018, as well as two other talks (one on Concepts and one on copy elision). I will also be running a two-day post-conference class, “The Standard Library From Scratch”, covering the same material as last year.
I didn’t submit “The Best Type Traits C++ Doesn’t Have” for CppCon, but I’ll be presenting it at the Bay Area C++ meetup in Santa Clara this Wednesday, 2018-06-06.