My C++Now 2018 talks are up
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::pmr
world, but true even when it’s not obvious. (An allocator can have other orthogonal bits besides just the handle. “Sticky” allocators, likestd::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
vector
can userealloc
(or at leastmemcpy
) under the hood, even for non-trivially-moveable types. Second, many types are trivially comparable, which essentially means yourvector::operator==
can usememcmp
under 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 anoptional<optional<...optional<T>>>
(nestedK
levels deep) from libc++’s currentsizeof(T) + 8*K
bytes to a constantsizeof(T) + 8
bytes (and in factsizeof(T)
for smallK
).
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.