In part
1 we implemented a barebones future-like class
that supported .then continuations without needing
allocations or type-erasure. The idea behind it was to encode the entire
computation chain into a single object with a huge type:
// pseudocode
auto f = initiate(A).then(B).then(C).then(D);
// ...would become something like:
/*
D<C<B<A>>>>
*/We previously stored the “parent” node by moving *this
as part of a generalized lambda capture, and stored the
Callable itself via EBO (empty base optimization).
As we will explicitly need access to the “parent” node’s type to support
non-blocking schedulers and implement when_all in the
future, it’s time significantly improve our design.